fseek from end?
3 messages in this thread
Hello. I have two confusing yet probably easy problems.
1. I have been trying to access the last record of my record struct. I
wanted to try the fseek (infile, -?L, 2); but I wound up with random data
when I printed out the record. I tried to use the "sizeof" operator
without success. Could someone show me the proper way to set up fseek with
a struct offset from the end of the file?
2. Second problem has to do with "embedding" the $VER: <name> etc, into
my program so it can be read by the shell VERSION command. I have tried
this with my Manx 3.6 compiler but keep getting errors. If you please, I
could use a hand here too.
Thanks in advance! Henry
Henry:
Item 2: In you C source, add: char vers[] = VERSTAG; /* Defined in a header
file */ #define VERSTAG "\0$VER: Programnane 1.0 (4.6.94)"
As for the first problem, fseek( fp, 0, SEEK_END ); should put you at the end
of the file. Negative numbers for the position are for a mode of 1.
–Andy
Hi Andy,
This summer is putting me behind on all my mail and computer time. I
want to thank you for the help with the VERSTAG and the fseek problem.
Have a nice summer, Henry