C - Conversion Options Specifications


%[0123456789.-] will read a numerical value as a string, so if the input is -1.25, it will be read as "-1.25".

To read a string consisting of the lowercase letters a to z, use the specification %[abcdefghijklmnopqrstuvwxyz].

The specification %[^,] will read everything in the string except a comma, so this form will enable you to read a series of strings separated by commas.

The following table shows a few examples of applying the various options.

Read the next value as type double.
Read the next integer value but don't store it.
Read the next 15 characters as type char.
Read the next character as type char ignoring whitespace characters.
Reads the next ten characters as an integer value of type long long.
Reads the next value as a floating-point value of type long double.
Reads the next value as type unsigned short.