delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/16/07:24:47

Date: Sun, 16 Jan 2000 10:31:44 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Aaron Chernosky <chernobl AT wt DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Binary Files
In-Reply-To: <3880A8CD.97FD4201@wt.net>
Message-ID: <Pine.SUN.3.91.1000116103010.11666Q-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 15 Jan 2000, Aaron Chernosky wrote:

> Should I just use fread like so: 
>   
>   fread(ch,1,1,fin); // if ch is a single char var?

It doesn't matter, you still need to open the stream in binary mode.

For reading a single character, getc is faster, because it's an inline 
function that expands to a few simple operations.  In contrast, fread 
will incur an overhead of a function call.

- Raw text -


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