Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

scanf field width

Name: Anonymous 2013-09-20 10:45

For the %s conversion specifier, is the field width in bytes or characters? The C standard is suggesting that the field width is always measured in characters, but there's this small note that confuses me:
246) No special provisions are made for multibyte characters in the matching rules used by the c, s, and [ conversion specifiers — the extent of the input field is determined on a byte-by-byte basis. The resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
Also, the opengroup documentation seems to be suggesting (see the description given for the %c specifier as well) it's in bytes if no l length modifier is present. Otherwise, it's in characters.

plz help me lambda‼

Name: Anonymous 2013-09-20 13:04

>>1
You should know that %characters are interpreted bytes in an address thanks to the preprocessor information in your stdio.h function. IOW, you can express %s with 0x6865785f76616c756573.

Also, ask these questions in the proper new site.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List