Ah, MSVCRT is very old and very non-compliant. Should someone use
fgets in a C program and rely on this behaviour and use mem* calls
to deal with NULs in the data stream, as opposed to the usual
practice of using str* calls on textual strings? Does the
developer has better, safer options?
I wouldn't want to write code that depends on
implementation-specific behaviour if I can help it, so I would
never dream of using fgets (or the Lua equivalent of "*l") for
anything that isn't standard text files. The issue just doesn't
arise. But that's just me, I guess.
The fgets() function shall read bytes from stream into the array
pointed to by s, until n-1 bytes are read, or a <newline> is read
and transferred to s, or an end-of-file condition is encountered.
The string is then terminated with a null byte.