Input
- int fgetc(FILE *) reads and returns a single
character from the passed file. If there are no more characters to be
read from the file, fgetc returns the special value EOF.
- We have already seen another useful file input function,
fgets(char *string, int len, FILE *).
This reads from the file into the string until
either the end of the line, the end of the file, or len-1
characters have been read -- whichever comes first. The string is
always /0 terminated, for your protection.
- There is also fscanf(FILE *, char *format, ...) which is
just as useful (or useless) as scanf. In fact, scanf
is usually just implemented as fscanf(stdin, ... ).
Next Slide