fgets function

fgets is used to read a line of data from an external source.

Library:   stdio.h

Prototype: char *fgets(char *s, int n, FILE *stream);

Syntax:    char  Data[80];
	   char *ReturnCode;
	   FILE *FilePointer;

	   ReturnCode=fgets(Data, 80, FilePointer);

	   ReturnCode == NULL when an error occours. The EOF is 
	   considered to be an ERROR!


example program number one.

example program number two.

program comparing the action of gets and fgets when reading STDIN.

See Also:

Top Master Index Keywords Functions

Martin Leslie