Mail Archives: djgpp/1999/08/14/13:39:30
From: | "Bas Hamstra" <bas DOT hamstraNOSPAM AT wxs DOT nl>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: length of file (baffling me)
|
Date: | Sat, 14 Aug 1999 16:46:49 +0200
|
Organization: | Planet Internet
|
Lines: | 43
|
Message-ID: | <7p3vef$1j2id$1@reader2.wxs.nl>
|
References: | <7p3u7u$ncb$1 AT nnrp1 DOT deja DOT com>
|
NNTP-Posting-Host: | gn0172-2.dial.wxs.nl
|
Mime-Version: | 1.0
|
X-Trace: | reader2.wxs.nl 934641935 1673805 195.121.152.172 (14 Aug 1999 14:45:35 GMT)
|
X-Complaints-To: | abuse AT wxs DOT nl
|
NNTP-Posting-Date: | 14 Aug 1999 14:45:35 GMT
|
X-Newsreader: | Microsoft Outlook Express 4.72.3155.0
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3155.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I think you should get the handle of the file opened with fopen().
Do this with the function
Handle = fileno(fp);
Then you can use
Lenghts = filelength(Handle);
jsc AT lds DOT co DOT uk heeft geschreven in bericht <7p3u7u$ncb$1 AT nnrp1 DOT deja DOT com>...
>Hello all, this must be an easy question, but I can't seem to get it to
work.
>All I'm trying to do is work out the length of a file. I use
>
>FILE *fp;
>fp = fopen(filename, "rb");
>
>where filename is just the argument in the function. And I can acces the
>bytes perfectly well, so I know I'm accessing the file correctly.
>
>but then when I try...
>
>printf( "File length: %i", filelength((int)fp) );
>
>I get -1 returned, indicating an error, but I can't see why.
>If anyone could help, I'd really appreciate it.
>Thanks a lot,
>Christopher
>--
>Christopher Anthony, Goldfish Style Council
>jsc AT lds DOT co DOT uk
>http://members.xoom.com/Billynomates/chris.html
>> > >
>Don't follow your dreams - chase them!
>Hunt them down! Grab on tight and never let go!!!! :)
> -Dr. Noitamina
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
- Raw text -