fseek in VAX C

Todd Pierzina 8099pierzina at vmsd.csd.mu.edu
Wed Jul 11 06:57:37 AEST 1990


I need help.

I am using VAX C, and I want to move backward through a data (record, not
stream!) file.  I am trying to use fseek.  I have RTFMed, and it is very
ambiguous as far as fseek and record files go.  The Unix version would be

      (void) fseek(fp, (long)-sizeof(record_type), L_INCR);

where fp is the file pointer.  In VAX C, the RTL manual says that using fseek
with a value not obtained from ftell is very unpredictable.  No sh*t.

I could set up a stack of ftell values going forward, then when I need to go
back, pop the locations off and feed them to fseek directly.  I think.  So my
questions(s):

Is there an EASY way to move backward?

Will my stack method work?  I do not understand how fseek/ftell work with
record files; the manual is VERY confusing.

Please reply directly to me, as I am not subscribed to these lists.
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