Mail Archives: djgpp/1997/09/30/14:30:55
Ingo Ruhnke wrote:
>
> I want to read a ASCII Text file, therefore I do allocate some memory
> with malloc() and therefore I need the filesize, more exactly the
> number of characters. At the moment I use this to get the file size:
>
> filelength(fileno(FILE *))
>
> This returns me the number of bytes of the file, but the number of
> chars is a little bit smaller, because of the <LF><CR>.
>
> So is there a standart way to get the number of chars in a file?
i wouldn't think so... at least not without reading in the whole file
first. what is the problem with reserving space for a few extra bytes?
-- Sinan
- Raw text -