DW> DR> How do I read/write files with multiple EOF's
DW> Forgive a "mere" Mac user ...
DW> In any (reasonable) DOS, EOF is *not* just an ASCII character.
DW> ... there is only one EOF in each file, at its very end.
Correct on all counts. ;)
However... DOS is not a reasonable OS, as you know.
A DOS file may be opened in two modes, text and binary.
In text mode, the character Ctrl/Z, CHR$(26), is the text
marker for EOF. DOS opens files in text mode by default,
and will only read until the first EOF. To read beyond the
first instance of EOF, you need to open the file in binary
mode, which reads to the limit of the file, as described in
the File Allocation Table, which is on the disk itself.
More that one ?NIX C coder has pulled up short on that
particular hazard when attempting to program for DOS, and
it is usually the BASIC programmer's first introduction to
opening files in BINARY mode, since the other most useful
thing you can do in BINARY is used fixed length files, which
BASIC handles in a different way, by having a separate file
type, the RANDOM file, which does the math for moving the
file pointer without the programer having to bother with it.
> ] It's never funny when you have to explain it. [ Joe Friday ]
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|