Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!tektronix!decvax!linus!philabs!masscomp!alang From: alang@masscomp.UUCP (Alan Groupe) Newsgroups: comp.sys.ibm.pc Subject: Turbo C file size routine Message-ID: <2475@masscomp.UUCP> Date: Fri, 30-Oct-87 15:29:45 EST Article-I.D.: masscomp.2475 Posted: Fri Oct 30 15:29:45 1987 Date-Received: Thu, 5-Nov-87 06:32:04 EST Reply-To: alang@masscomp.UUCP (Alan Groupe) Organization: MASSCOMP - Westford, Ma Lines: 13 I'm looking for a way to determine the size of a text file from within Turbo C. Determining the size of a binary file is trivial, using the stat call, but if I open the file in text mode, stat returns the same value, which is now incorrect (ie. CR/LF count as two characters in the count, although are read as a single newline character. So far, I've been opening the file in text mode and running the following loop, but this is slow: i=0; while (getc(fp) >= 0) i++; Is there a faster way to do this? Alan Groupe