J
J de Boyne Pollard
HS> fgets() is standard in C file I/O.
HS>
HS> The only issue you need to pay attention too, is RAW
HS> (binary) vs COOK mode. It will relate the EOL (end
HS> of line) definitions of MS-DOS (<CRL><LR>) vs
HS> Unix (<LF>). Depending on your application that
HS> may or may no pertain.
TR> This is a handy definition, but it is NOT CORRECT. [...]
TR> The raw vs cooked distinction in Unix is VERY different
TR> from the binary vs text distinction in MS-DOS. [...]
Actually, the binary/text dichotomy comes from the C language. The
operating systems themselves have and make no such distinction. (To
the operating systems themselves, files are just octet streams. There
are no lines, no newline sequences, and no EOF marker characters.) It
is simply the case that C language implementations targetting PC/MS/DR-
DOS use the either-CR+LF-or-LF newline convention for text files
(although they are not required to do so), and C language
implementations targetting Unices and Linux use the LF newline
convention for text files (and are required to do so by the POSIX
standard, which defines additional restrictions on C implementations).
HS>
HS> The only issue you need to pay attention too, is RAW
HS> (binary) vs COOK mode. It will relate the EOL (end
HS> of line) definitions of MS-DOS (<CRL><LR>) vs
HS> Unix (<LF>). Depending on your application that
HS> may or may no pertain.
TR> This is a handy definition, but it is NOT CORRECT. [...]
TR> The raw vs cooked distinction in Unix is VERY different
TR> from the binary vs text distinction in MS-DOS. [...]
Actually, the binary/text dichotomy comes from the C language. The
operating systems themselves have and make no such distinction. (To
the operating systems themselves, files are just octet streams. There
are no lines, no newline sequences, and no EOF marker characters.) It
is simply the case that C language implementations targetting PC/MS/DR-
DOS use the either-CR+LF-or-LF newline convention for text files
(although they are not required to do so), and C language
implementations targetting Unices and Linux use the LF newline
convention for text files (and are required to do so by the POSIX
standard, which defines additional restrictions on C implementations).