函数名: fgetc
功 能: 从流中读取字符
用 法: #include <stdio.h>
int fgetc(FILE *stream);
程序例:
#include <string.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
FILE *stream;
char string[] = "This is a test";
char ch;
/* open a file for update */
stream = fopen("DUMMY.FIL", "w+");
/* write a string into the file */
fwrite(string, strlen(string), 1, stream);
/* seek to the beginning of the file */
fseek(stream, 0, SEEK_SET);
do
{
/* read a char from the file */
ch = fgetc(stream);
/* display the character */
putch(ch);
} while (ch != EOF);
fclose(stream);
return 0;
}