get a string of characters from a file
#include <stdio.h> char *gets( char *buf ); char *_ugets( _unichar *buf );
The gets() function gets a string of characters from the file designated by stdin, and stores them in the array pointed to by buf until end-of-file is encountered or a new-line character is read. Any new-line character is discarded, and a null character is placed immediately after the last character read into the array.
A common programming error is to assume the presence of a new-line character in every string that is read into the array. A new-line character might not appear as the last character in a file, just before end-of-file.
The gets() function returns buf if successful. NULL is returned if end-of-file is encountered, or if a read error occurs. When an error has occurred, errno contains a value that indicates the type of error that has been detected.
errno, fopen(), getc(), fgetc(), fgets(), ungetc()
#include <stdio.h> void main() { char buffer[80]; while( gets( buffer ) != NULL ) puts( buffer ); }
ANSI
All (except DOS/PM)