Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!TOR.NTA.NO!x_larsen_b%use.uio.uninett From: x_larsen_b%use.uio.uninett@TOR.NTA.NO.UUCP Newsgroups: comp.os.vms Subject: Problem with fixed format files in VAX C. Message-ID: <295:x_larsen_b@use.uio.uninett> Date: Sat, 6-Jun-87 02:46:18 EDT Article-I.D.: use.295:x_larsen_b Posted: Sat Jun 6 02:46:18 1987 Date-Received: Sun, 7-Jun-87 03:17:59 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 49 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