본문 바로가기

카테고리 없음

C/C++의 valist 사용 시, type 별 % 표기법, printf

Output the corresponding argument as a character, a string, or a number. This field can be any of the following values.

c

Single character. This value is interpreted as type WCHAR if the calling application defines Unicode and as type __wchar_totherwise.

C

Single character. This value is interpreted as type __wchar_t if the calling application defines Unicode and as type WCHARotherwise.

d

Signed decimal integer. This value is equivalent to i.

hc, hC

Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type __wchar_t, even when the calling application defines Unicode.

hd

Signed short integer argument.

hs, hS

String. This value is always interpreted as type LPSTR, even when the calling application defines Unicode.

hu

Unsigned short integer.

i

Signed decimal integer. This value is equivalent to d.

lc, lC

Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type WCHAR, even when the calling application does not define Unicode.

ld

Long signed integer. This value is equivalent to li.

li

Long signed integer. This value is equivalent to ld.

ls, lS

String. This value is always interpreted as type LPWSTR, even when the calling application does not define Unicode. This value is equivalent to ws.

lu

Long unsigned integer.

lx, lX

Long unsigned hexadecimal integer in lowercase or uppercase.

p

Pointer. The address is printed using hexadecimal.

s

String. This value is interpreted as type LPWSTR when the calling application defines Unicode and as type LPSTRotherwise.

S

String. This value is interpreted as type LPSTR when the calling application defines Unicode and as type LPWSTRotherwise.

u

Unsigned integer argument.

x, X

Unsigned hexadecimal integer in lowercase or uppercase.


LONGLONG use %I64d 



double to string use %g


참조  : http://msdn.microsoft.com/en-us/library/windows/desktop/ms647550(v=vs.85).aspx