2010/10/08

Visual C++ 에서 64비트 정수 출력하기

__int64    i64 = 0x12341234abcdabcd;

char szDispBuf[1024];

sprintf_s( szDispBuf, 1024,
"%%d => %d \n"
"%%o => 0%o \n"
"%%x => 0x%x \n"
"%%X => 0x%X \n"
"%%I64d => %I64d \n"
"%%I64o => 0%I64o \n"
"%%I64x => 0x%I64x \n"
"%%I64X => 0x%I64X \n"
, i64, i64, i64, i64, i64, i64 );

TRACE("%s \n", szDispBuf );

Output:
%d => -1412584499
%o => 02215011064
%x => 0xabcdabcd
%X => 0x12341234
%I64d => 1311693408901639117
%I64o => 0110640443225363325715
%I64x => 0x12341234abcdabcd
%I64X => 0x12341234ABCDABCD
<

Original Post : http://neodreamer-dev.tistory.com/465

No comments :

Post a Comment