home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / question / 13322 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  1004 b 

  1. Path: sparky!uunet!portal!lll-winken!fnnews.fnal.gov!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.cecer.army.mil!naam
  2. From: naam@cecer.army.mil (Ramez Naam)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: A few more quick C questions...
  5. Message-ID: <naam.721602824@lorax.cecer.army.mil>
  6. Date: 12 Nov 92 21:13:44 GMT
  7. References: <c-r1bx#@rpi.edu>
  8. Sender: news@news.cecer.army.mil (Net.Noise owner)
  9. Organization: US Army Corps of Engineers Construction Engineering Research Labs
  10. Lines: 15
  11.  
  12. cecchinr@hornsby.cs.rpi.edu (Ron Cecchini) writes:
  13.  
  14. >2) Is there a command to determine a file's size?
  15. >   [I think the data structure pointed to by a FILE contains a ->_cnt feild
  16. >    that can be used - I'll try it in a minute...]
  17.  
  18. # include <io.h>
  19. long filelength(int handle);
  20.  
  21. or, if your library doesn't have filelength:
  22.  
  23. error = fseek(*file,2);  /* Sets file pointer to end of file */
  24.             /* returns 0 on success */
  25. size = ftell(*file); /* Returns offset of file pointer (long int) in bytes. */
  26.             /* returns -1L on fail */
  27.