%[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.
Specification | Description |
---|---|
%lf | Read the next value as type double. |
%*d | Read the next integer value but don't store it. |
%15c | Read the next 15 characters as type char. |
\n%c | Read the next character as type char ignoring whitespace characters. |
%10lld | Reads the next ten characters as an integer value of type long long. |
%Lf | Reads the next value as a floating-point value of type long double. |
%hu | Reads the next value as type unsigned short. |