❑ Format string is a string containing one or more format specifiers.
❑ Format specifier has the following syntax.
%[Parameter][Flag][Width][Precision][Length][Type]
❑ Parameter field
| Character | Description |
| n$ | Select a value(direct parameter access).
* 1$ exists in esp+4 on x86.
* 2$ → esp+8
|
❑ Flag field
| Character | Description |
| + | prepend + or - sign. |
| - | Left-align. |
| 0 | If "Width" field is used, empty space is filled with zeros. |
| (Space) | Prepend "space character" to the positive number. Prepend "-" to the negative number. |
| # | Prepend 0 to the octal number. Prepend 0x to the hexadecimal number. |
❑ Width field
| Character | Description |
| n or * | Specify the minimum number of characters to print. |
❑ Precision field
| Character | Description |
| .n or .* | - Decimal type : Same function as Width field. - Float type : Specify the number of digits after the decimal point. - String type : Specify the number of characters. |
❑ Length field
| Character | Description |
| h | Data type size down(int → short). |
| hh | Data type size down(int → char). |
| l | Data type size up(int → long). |
| ll | Data type size up(int → long long). |
| L | Data type size up(double → long double). |
| z | Data type change(int → size_t). |
| j | Data type change(int → intmax_t). |
| t | Data type change(int → ptrdiff_t). |
❑ Type field
| Character | Description |
| d, i | Int type value. |
| u | Unsigned int type value. |
| f, F | Double type value with decimal point. |
| e, E | Double type value with exponent. |
| g, G | Efficient double type value. |
| c, C | Char type value. |
| a ,A | Double type value with hexadecimal. |
| p | Unsigned int type address with hexadecimal. |
| x, X | Unsigned int type value with hexadecimal. |
| o | Unsigned int type value with octal. |
| s | - String type value. - Read string type value from char *. |
| n | Write the printed size so far into the following 4 Bytes address.
* Examples of use(Link)
|
| hn | Write the printed size so far into the following 2 Bytes address. |
| hhn | Write the printed size so far into the following 1 Bytes address.
* If the size output so far causes an overflow in the memory space, the counted value from the beginning is input.
* e.g. If 0x101 is input to the space of 0xFF size, 0x2 is stored.
* 지금까지 출력된 사이즈가 메모리 공간에서 오버플로우를 발생시키면, 처음부터 다시 카운팅 된 값이 입력된다.
* e.g. 0xFF 크기의 공간에 0x101이 입력되면 0x2가 저장된다.
|
