home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!hela.iti.org!usc!rpi!cecchinr
- From: cecchinr@hornsby.cs.rpi.edu (Ron Cecchini)
- Subject: Getting a file's size with the FILE data structure
- Message-ID: <l=r19z_@rpi.edu>
- Nntp-Posting-Host: hornsby.cs.rpi.edu
- Organization: Rensselaer Polytechnic Institute, Troy, NY
- Date: Thu, 12 Nov 1992 21:14:35 GMT
- Lines: 13
-
- Hi again,
-
- I found that you can use the FILE ds to get a file's size. However,
- there seems to be a glitch with it. For one, the data structure is
- NOT initialized after the fopen(). So, thats no good. And you can't try
- to fseek() to the beginning and look at ->_cnt. What I found you have to do
- is: fgets() a line from the file and *THEN* fseek() back to the beginning
- of the file. *NOW* ->_cnt contains the size of the file.
-
- Ron
-
- p.s. I have received info on using the stat() command to also get the info.
-
-