Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 174 -
------------------------------------------------------------------------------
6.20 Read a strings from a stream
. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
fgets
[Syntax]
#include <stdio.h>
char *fgets( char *string, int n, FILE *stream ) ;
[Arguments]
string Buffer in which data is stored.
n Buffer size.
stream Pointer to a FILE structure.
[Return]
Returns "string" if successful. Returns NULL if any error or the end
of file is detected. Use "feof" and "ferror" functions to distinguish
an error from EOF.
[Description]
Reads characters from a file linked to "stream" and stores them in
"string". Reading is repeated until newline character('\n') is
detected, the end of the stream is detected, or a length of read
character become equivalent to "n-1". The result is stored in
"string" adding null character('\0'). If "n" is 1, "string" is
empty (""). This function is similar to "gets" function, but "gets"
replaces a newline character to a null character.