delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/29/23:03:40

From: "Ingo Ruhnke" <ruhnke AT owl-online DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: How to get file size?
Date: 29 Sep 1997 19:12:30 GMT
Organization: Telemedia News Server
Lines: 13
Message-ID: <01bccc5b$8138ba00$0200a8c0@ingo>
NNTP-Posting-Host: gtso-m71-141.pool.mediaways.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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?

Thanks to everyone who could help,
Ingo

- Raw text -


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