[comp.os.vms] fseek, ftell in VAX C

8099pierzina@vmsd.csd.mu.edu (Todd Pierzina) (07/13/90)

The other day I asked for help using fseek and ftell on record files with VAX
C.  The first solution was to use ftell to get my position, then use fseek in
absolute mode:

      curpos = ftell(file_p);
      fseek(file_p, curpos, 0);

Well, this is very inefficient for long files.  So what did I do?  I used an
FDL to convert the data file to stream_LF.  Piece of cake, now everything works
(almost).  When you do a read and then check for eof, it seems that the file
pointer moves, so you can't just fseek(file_p, 0, 1) and then write; you have
to do an absolute positioning (or maybe fseek(file_p, -1, 1)).  Oh well, I got
it to work all by myself.  Hurray.

Todd Pierzina

Student Programmer
Marquette University
8099PIER@MUCSD                (BITNET)
8099pierzina@vmsd.csd.mu.edu  (Internet)