fgets
fgets is a standard C library function used to read a string from a file stream. It is declared in the header stdio.h and operates on buffers provided by the caller.
The function signature is: char *fgets(char *restrict s, int n, FILE *restrict stream); It reads up to
A key aspect of fgets is that it ensures the buffer is null-terminated, provided that n is
Buffer size and safety: the caller must supply a buffer large enough for n characters, as fgets
Related considerations: fgets is buffered by the C standard I/O library and can be used with any