syat #8994(2009/05/23 01:12 GMT) [ C ] Rating0/0=0.00
see: HeadWing | 64bit Integer in MinGWC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdio.h> #include <stdlib.h> #ifdef _MSC_VER #define strtoull _strtoui64 #endif #ifdef __MINGW32__ #define FORMAT_LLU "%I64u" #else #define FORMAT_LLU "%llu" #endif int main(void) { char buf[128]; memset(buf, 0x00, sizeof(buf)); if ( fgets(buf, sizeof(buf), stdin) ) { unsigned long long ll; ll = strtoull(buf, NULL, 16); printf(FORMAT_LLU, ll); } return 0; }
Rating0/0=0.00-0+
1 reply [ reply ]
syat #8995(2009/05/23 01:22 GMT) Rating0/0=0.00
書き忘れましたが、扱える整数の幅は符号なし64bitなので、 0 ~ 18446744073709551615 です。
[ reply ]
syat
#8994()
[
C
]
Rating0/0=0.00
strtoull で変換し、printf の %ull で出力するのが標準かと。
VC2008EE と gcc(MinGW) で確認しました。
see: HeadWing | 64bit Integer in MinGWC
Rating0/0=0.00-0+
1 reply [ reply ]