C Standard Library: Formatted Input

Formatted Input

The scanf function deals with formatted input conversion.
int fscanf(FILE *stream, const char *format, ...)
fscanf reads from stream under control of format, and assigns converted values through
subsequent arguments, each of which must be a pointer. It returns when format is exhausted.
fscanf returns EOF if end of file or an error occurs before any conversion; otherwise it returns
the number of input items converted and assigned.

int scanf(const char *format, ...)
scanf(...) is identical to fscanf(stdin, ...).
int sscanf(const char *s, const char *format, ...)
sscanf(s, ...) is equivalent to scanf(...) except that the input characters are
taken from the string s.

原文地址:https://www.cnblogs.com/freewater/p/2972237.html