Home > Electronics Tutorials > C Language Tutorial > stdio.h - Character I/O Functions - fgets

C Language Programming Library Reference Guide

stdio.h - Character I/O Functions - fgets

Declaration: char *fgets(char *str, int n, FILE *stream); Reads a line from the specified stream and stores it into the string pointed to by str. It stops when either (n-1) characters are read, the newline character is read, or the end-of-file is reached, whichever comes first. The newline character is copied to the string. A null character is appended to the end of the string.

On success a pointer to the string is returned. On error a null pointer is returned. If the end-of-file occurs before any characters have been read, the string remains unchanged.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......