Subj : Re: newbie question [C language] To : comp.programming From : amorgan Date : Thu Jun 30 2005 11:21 pm In article <3ii95nFlnl7mU1@individual.net>, osmium wrote: >"Fred_NacH" writes: > >> I was wondering, how to retrieve the size/length of a file by only using >> the ansi functions... > >This one often causes a lot of controversy, some people say there is a >(usually unnamed) system on which it won't work or at least there *could >have been* a system on which it wouldn't work if such a system had been >built. > >Open the file in *binary* mode, seek to end of file, and use ftell() to see >where you are. If you like acrimony and pedantry, look around on Usenet for >these discussions which flare up from time to time. This won't work if you don't have read permission on the file. It also won't work if the size of the file is larger than the value that can be reported by ftell(). Really, it doesn't matter if there is some magical ansi way of doing this. There are OS specific ways of doing this that are much easier. Wrap them in a generic API and shove them in a separate file. Alan -- Defendit numerus .