x_larsen_b%use.uio.uninett@TOR.NTA.NO.UUCP (06/06/87)
I'm a bit confused at the moment.
I am trying to read/write 512 byte fixed format files
using VAX-11 C, and have the following problem:
If I execute the program below with '#define FIXED 0', I
get a file X.X containing the sequence "!**********".
That looks fine.
If I try with '#define FIXED 1', I get the output "*********!".
If somebody could give me a clue to what is going on, I would
appreciate it.
Btw: Yes, I AM aware of the fact that fseek should only be used with
values returned by ftell. But I don't think that is relevant in this
particular case.
+++++++++++++++++++++++++++++++++++++++
#define FIXED 1
#include stdio
main() {
FILE *f;
int idx;
#if FIXED
f = fopen ("x.x", "w+", "mrs=512", "rfm=fix");
#else
f = fopen ("x.x", "w+");
#endif
for (idx=0; idx<10; idx++) fputc ('*', f);
fseek (f, 0L, 0);
fputc ('a', f);
};
+++++++++++++++++++++++++++++++++++++++
(I am running VAX C 2.1-007 and VMS 4.5.)
-----
Bjorn Larsen x_larsen_b%use.uio.uninett@tor.uio.no
Computing Centre x_larsen_b@inger.arpa
University of Oslo blarsen@ifi.uio.no
Norway