get a string of characters from a file
#include <stdio.h> char *fgets( char *buf, size_t n, FILE *fp );
The fgets() function gets a string of characters from the file designated by fp, and stores them in the array pointed to by buf. The fgets() function stops reading characters when:
whichever comes first. The new-line character is not discarded. A null character is placed immediately after the last character read into the array.
The gets() function is similar to fgets(), except that it operates with stdin, it has no size argument, and it replaces a newline character with the null character.
errno, fopen(), getc(), gets(), fgetc()
#include <stdio.h> void main() { FILE *fp; char buffer[80]; fp = fopen( "file", "r" ); if( fp != NULL ) { while( fgets( buffer, 80, fp ) != NULL ) fputs( buffer, stdout ); fclose( fp ); } }
ANSI
All (except DOS/PM)