FGETS - get a string from input.

(ANSI Standard)

Usage:

#include <stdio.h>
ptr = fgets( s, N, f );

Where:

char *s;
points to an area of memory that will receive the string that is read in.
int N;
indicates the maximum length of the input string.
FILE *f;
points to the file that is to be read.
char *ptr;
will point to the string that is read in (i.e. "ptr" is the same as "s").

Description:

"fgets" reads a maximum of N-1 characters from the input file "f" into the area of memory pointed to by "s". "fgets" will stop reading if it encounters a new-line character before N-1 characters have been read. The last character read into string "s" will be followed by a terminating '\0'.

If a read error occurs or end of file is reached, "fgets" returns a null pointer.

Copyright © 1996, Thinkage Ltd.