CompuServe Thread

C: fopen

3 messages in this thread
#11657From: Mike BerroMar 16, 1986 2:16 AM
A question for all you C wizards: I've tried using fptr = fopen("filename", "a"); to append data to the end of a file, but it works just like "w", i.e. it zaps what was already there. I know I must be doing something wrong, but I don't know what… By the way, has anyone benchmarked assembly language, as compared to Lattice, Aztec, etc. C? I personally find C harder to program in than assembly, except I can't find much info on assembly for the Amiga. Thanx! —Mike
#11865From: Larry MillerMar 18, 1986 3:41 AM
Lattice C HAS A BUG AND APPEND MODE DOES ***NOT*** WORK. It Zaps the file just as you say. The only thing you are doing wrong is trying to use this mode AT ALL……… Somewhere in the DLs here is a list of known Lattice C bugs. That one is the worst of them, thank goodness.
#12002From: Mar 19, 1986 2:21 PM
This bug is not entirely attributable to Lattice. Just to set the record straight — Lattice has decided to do IO by calling the DOS IO functions. If you look at file _main.c you will see that the iob structure gets the DOS file-handle put into it. The same goes with seek. The fault lies in DOS, and according to my information will be fixed in the next release. Why not take the time to use the DOS file calls directly. Although the seek bug still exists, maybe there is a workaround. I haven't heard of any, though. AS I posted before, eliminate the calls to Lattice files Lstartup and lc.lib, and you will reduce the size of your obj file. WARNING: forget to menion, most of the standard io stuff is there, eg. printf, but do not necessarily provide the full functionality. Anyway, this is only a suggestion and it does work in many cases. Randy Weiner <<cbm>>