fseek, ftell in VAX C

Todd Pierzina 8099pierzina at vmsd.csd.mu.edu
Fri Jul 13 06:17:51 AEST 1990


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 at MUCSD                (BITNET)
8099pierzina at vmsd.csd.mu.edu  (Internet)



More information about the Comp.lang.c mailing list