C:printf
c printf method.
printf unsigned long long int type
- Stackoverflow: How do you printf an unsigned long long int(the format specifier for unsigned long long int)?
- KLDP: long long 형과 printf의 문제?
Use the ll (el-el) long-long modifier with the u (unsigned) conversion. (Works in windows, GNU).
printf std::size_t type
Printf Tricks
It may be old-fashioned, but I still find printf (and sprintf and _vsnprintf) incredibly useful, both for printing debug output and for generating formatted strings. Here are a few lesser-known formats that I use again and again. See MSDN for the full reference.
-
%04x
- 4-digit hex number with leading zeroes -
%p
- pointer -
%I64d, %I64u, %I64x
- 64-bit integers -
%Iu, %Id, %Ix
- ULONG_PTR -
%*d
- runtime width specifier -
%.*s
- print a substring -
%.0d
- print nothing for zero -
%#x
- print a leading 0x
C++ format
See also
- Bash:Printf - bash의 printf 명령
Favorite site
- Wikipedia (en) printf format string
- cplusplus.com - printf
- printf 표준 출력장치로 서식에 맞추어 출력
- C 언어 레퍼런스 - printf 함수
References
-
Weblogs.asp.net_-_printf_tricks.pdf ↩