Higher-Level I/O capabilities
We have already seen that printf handles formatted output to stdout. The counterpart statement for reading from stdin is scanf. The syntax scanf("format string", variables);
resembles that of printf. The format string may contain blanks or tabs (ignored), ordinary ASCII characters, which must match those in stdin, and conversion specifications as in printf. Equivalent statements exist to read from or write to character strings. They are:
sprintf(string, "format string", variables);
scanf(string, "format string", variables);
The ``string'' argument is the name of (i.e. a pointer to) the character array into which you want to write the information.
No comments:
Post a Comment