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