home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 13100 < prev    next >
Encoding:
Internet Message Format  |  1992-09-01  |  942 b 

  1. Path: sparky!uunet!pacsoft!mike
  2. From: mike@pacsoft.com (Mike Stefanik)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to randomly access files in C?
  5. Message-ID: <1371@pacsoft.com>
  6. Date: 2 Sep 92 04:32:15 GMT
  7. References: <17uctaINNco3@agate.berkeley.edu> <9224511.24878@mulga.cs.mu.OZ.AU>
  8. Organization: Pacific Software Group, Riverside, Ca.
  9. Lines: 12
  10.  
  11. In an article, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  12. >Some files (eg. stdin) may not be seekable, in which case you would probably
  13. >have to store the last few lines in memory. However for most files,
  14. >ftell() and fseek() should do what you want (RTFM ;-).
  15.  
  16. If portability is a concern, use fgetpos() and fsetpos().  The reason being
  17. that the fseek() and ftell() functions use a signed long integer as the
  18. offset -- which can be a problem with large files on 8 or 16 bit machines.
  19.  
  20. -- 
  21. Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike
  22. Pacific Software Group, Riverside, CA
  23.