From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: How to get file size? Date: Mon, 29 Sep 1997 16:39:49 -0500 Organization: Cornell University Lines: 17 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <34302025.7E59@cornell.edu> References: <01bccc5b$8138ba00$0200a8c0 AT ingo> Reply-To: sinan DOT unur AT cornell DOT edu NNTP-Posting-Host: 128 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 . > > 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