Reads a specified number of characters from a stream and stores them in a string.
#include <stdio.h> char *fgets(char *string, int n, FILE *stream);
#include <wchar.h>
wchar_t *fgetws(wchar_t *string, int n, FILE *stream);
string
n
n is 1, string is empty.
stream
Characters are read from the current stream position up to and including the first newline character \n, up to the end of the stream, or until the number of characters read is n-1, whichever comes first.
fgets is similar to gets; however, gets replaces the newline character with a null character.
fgetws is the wide-character version of fgets.
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
|---|---|---|
| _fgetts | fgets | fgetws |
| Versions | Defined in | Include | Link to |
|---|---|---|---|
| INtime 3.0 INtime 6.0 (for the wide-character and generic text versions) |
intime/rt/include/stdio.h intime/rt/include/wchar.h intime/rt/include/tchar.h |
stdio.h wchar.h tchar.h |
clib.lib |