Standard C++ Library Reference ISO/IEC (VERSION3)

%n int *x
%hn short *x
%ln long *x
%o unsigned int *x strtoul 8
%ho unsigned short *x strtoul 8
%lo unsigned long *x strtoul 8
%p void **x
%s char x[]
%ls wchar_t x[]
%u unsigned int *x strtoul 10
%hu unsigned short *x strtoul 10
%lu unsigned long *x strtoul 10
%x unsigned int *x strtoul 16
%hx unsigned short *x strtoul 16
%lx unsigned long *x strtoul 16
%X unsigned int *x strtoul 16
%hX unsigned short *x strtoul 16
%lX unsigned long *x strtoul 16
%[...] char x[]
%l[...] wchar_t x[]
%% none
The scan conversion specifier (or scan set) determines any behavior not summarized in this
table. In the following descriptions, examples follow each of the scan conversion specifiers. In
each example, the function sscanf matches the bold characters.
You write %c to store the matched input characters in an array object. If you specify no field
width w, then w has the value one. The match does not skip leading white space. Any sequence
of w characters matches the conversion pattern.
sscanf("129E-2", "%c", &c) stores '1'
sscanf("129E-2", "%2c", &c[0]) stores '1', '2'
For a wide stream, conversion occurs as if by repeatedly calling wcrtomb, beginning in the
initial conversion state.
swscanf(L"129E-2", L"%c", &c) stores '1'