fgets

Gets a string from a stream.

char * fgets (char * string, int n, FILE * stream);

Required Header
<stdio.h>

Return Value

This function returns a string from a stream or NULL if an error or End Of File has been reached.

Parameters

string

  A pointer to the buffer which will contain the result

n

  The maximum number of characters to read

stream

  A pointer to the open FILE structure

Remarks

The fgets function reads stream up until n characters or the next newline character and stores the result in string.

Stream I/O Routines

See Also    fputc, fgetc, _fgetchar, fread, getc, getchar, gets