[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

EOF characters in XyWrite files



> In most file formats for other
> programs, wouldn't more than one EOF amount to a
> corrupted file ?

There are two ways to read a file from disk...

1. pick up the number of bytes the directory claims to be the file size and read that
many bytes.
or
2. read the bytes until you get an EOF byte (26) and then stop

Up until XyWrite had docinfo, any character 26 characters encountered would signify
End of File (EOF)
In order to implement docinfo, a delimiter had to be found that could separate
document content from the docinfo area, and EOF was the only character that could not
be expected within an existing XyWrite file.

By placing the docinfo at the end of the actual document content, it provided
backward compatibility with previous versions in that the docinfo could be ignored
without breaking the actual document content.

Technically, one could argue that once XyWrite used the EOF 'character' to separate
actual content from meta content, such files were no longer ASCII, but binary in
nature. I suspect that if you copy such a file at the DOS prompt with
copy foo.xy /a foo2.xy
you may find that the docinfo that was in foo.xy is not in foo2.xy as the /a means
treat the file as ASCII

'ASCII file' has a semantic meaning even though ASCII files are streams of bytes and
essentially no different from binary files. Part of that semantic is that character
26 indicates the end of the file.

So binary files can have as many EOF characters as one likes. Each byte of the file
is simply a value between 0 and 255 and 26 can be treated just like any other.

Dale
http://dale.mixmox.com