From: Shawn Jefferson (sjefferson_at_sd62.bc.ca)
Date: 2002-05-31 19:01:54
Hi Chris, >ftp://ftp.aladdin.de/pub/people/chris/cc65/shawn.zip > >> >> Did you look into the append mode for opening a file? > >I've implemented support for fopen(..,"a"). But it's not tested yet >by me. It's already included in above zip. I don't see a way to >support "a+", since AtariDOS insists on write-only if the append bit >is set. I've tested with this new atari.lib and here's what I found: AtariDOS append mode: works! fopen(r+), fseek(end), write: doesn't work, fseek not implemented in AtariDOS fopen(r+), read to feof, write: doesn't work, limitation of AtariDOS(?) fopen(r+), fseek(set+4), write: doesn't work, fseek not implemented in AtariDOS All this works as I was expecting it to, except that when you open a file in r+ mode, read to the end of the file and write some bytes, fwrite returns the number of bytes that you wanted to write, even though no bytes get written since AtariDOS doesn't allow writing past the end of the file in r/w mode. SpartaDOS append mode: works! fopen(r+), fseek(end), write: works! fopen(r+), read to feof, write: doesn't work, never finds EOF, limitation of SpartaDOS(?) fopen(r+), fseek(set+4), write: works! I wonder is there is some way to get SpartaDOS to signal an EOF that we can detect? If we design a routine to read records until feof (which is pretty common) it simply won't work in r/w mode in Sparta. Not a huge problem since we can get around it by reading in read mode, and then switching to another mode for writing. ftell would be nice for that, is it implemented? Didn't seem to be when I tested it. Great work, Chris! The C64 guys have to be really jealous now. ;) ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2002-05-31 19:03:03 CEST