J
jameskuyper
Bart C wrote:
....
There are real, moderately popular systems in current use which have
conforming implementations of C, where files are record-based, and the
operating system keeps track of how much of each record is actually
used. On some of those systems, lines of text are padded to the end of
a record. They might be padded with '\0', or ' ', or even arbitrary
garbage - I don't know, and you shouldn't assume that you know either.
The operating system provides routines that allow you to determine
where the lines actually end, but the only way to determine this while
using exclusively the C standard library is to open the file in text
mode. Will your code work correctly on such a system, both for reading
and for writing?
....
I'm used to text files using one of CR, LF or CRLF to terminate lines. I
have routines that read a line at a time and take care of this. And binary
mode means a 'getfilesize()' function is more accurate.
There are real, moderately popular systems in current use which have
conforming implementations of C, where files are record-based, and the
operating system keeps track of how much of each record is actually
used. On some of those systems, lines of text are padded to the end of
a record. They might be padded with '\0', or ' ', or even arbitrary
garbage - I don't know, and you shouldn't assume that you know either.
The operating system provides routines that allow you to determine
where the lines actually end, but the only way to determine this while
using exclusively the C standard library is to open the file in text
mode. Will your code work correctly on such a system, both for reading
and for writing?