The scanf command allows you to read from the terminal using a specified format. The formatting information is provided by a format string.
The sscanf command below reads an integer, a space, a character, and a floating-point value from the string given as the first argument.
>
|
sscanf("892 123.456E7","%d %c%f");
|
| (2.4.2.1) |
Several format codes are available for use with scanf. A few of the more commonly used ones are mentioned here.
"d" -- integer
"f" -- floating-point number
"c" -- character
"s" -- string
"a" -- Maple expression