I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C).
char buf[1000]; //bad coding unsigned __int64 l = 12345678; char t1[6] = 'test1'; char t2[6] = 'test2'; sprintf(buf, '%lli, %s, %s', l, t1, t2);
gives the result
12345678, (null), test1
(watch that test2 is not printed)
and l = 123456789012345 it gives an exception handle
any suggestions?
To print an
unsigned __int64value in Visual C++ 6.0 you should use%I64u, not%lli(refer to this page on MSDN).%lliis only supported in Visual Studio 2005 and later versions. So, your code should be: