TIP: Click on subject to list as thread! ANSI
echo: aust_avtech
to: Roy McNeill
from: Paul Edwards
date: 1997-01-19 00:44:44
subject: getc()

BL>   I don't understand why fread() is faster than getc(). How do they
BL> get the file data into the buffer? Don't you have to move it one
BL> character at a time?

RM> yes, but getc() does it with a call to a C function for *each*
RM> character, instead of reading a bunch of chars with just one
RM> function call.

Actually, getc() is normally a macro.  fgetc() does the function call.

RM> I learned this the hard way with output - it's a lot faster to
RM> write a whole string to the screen than it is to write the string
RM> one char at a time.

Sure.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.