www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/14/12:57:03

From: jsc AT lds DOT co DOT uk
Newsgroups: comp.os.msdos.djgpp
Subject: Filelength question (baffled no more) - just ignore it
Date: Sat, 14 Aug 1999 14:50:35 GMT
Organization: Deja.com - Share what you know. Learn what you don't.
Lines: 34
Message-ID: <7p3vnp$ocs$1@nnrp1.deja.com>
NNTP-Posting-Host: 194.73.88.189
X-Article-Creation-Date: Sat Aug 14 14:50:35 1999 GMT
X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.0; Windows 95)
X-Http-Proxy: 1.0 x22.deja.com:80 (Squid/1.1.22) for client 194.73.88.189
X-MyDeja-Info: XMYDJUIDbillynomates
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all, sorry, I'm stupid and I've sorted out the problem. I was using the
file pointer, not the raw file handle number. Works now - sorry again


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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019