函数名: fscanf
功 能: 从一个流中执行格式化输入
用 法: #include <stdio.h>
int fscanf(FILE *stream, char *format[,argument...]);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int i;
printf("Input an integer: ");
/* read an integer from the
standard input stream */
if (fscanf(stdin, "%d", &i))
printf("The integer read was: %i\n",
i);
else
{
fprintf(stderr, "Error reading an \
integer from stdin.\n");
exit(1);
}
return 0;
}