TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-11-30 07:50:50
subject: tic

BL> It seems to run a bit faster than fread() with a 128-byte
BL> buffer. I thought they might have a trick.

BL> I meant it's a bit faster the other way around. fgets()/fputs() is
BL> faster. If I read/write a file using fread()/write() with a 128-byte
BL> buffer and then do fgets(s, 128, *file) then fgets() is a little
BL> faster. 

fgets() would be faster after fread() if the fread() had just loaded a
512-byte buffer for you, and now your fgets is just reading out of the
buffer, instead of the fgets() having to do both.

BL> I didn't try it. Why would it be any different to fgetc()? It's
BL> much

PE> It's a macro instead of a function call.

BL> Doesn't that mean it just calls another function?

No.  It can, but normally getc() is implemented by a 6-line macro which
just accesses a the buffer directly.

PE> Which is actually what both fgetc() and getc() do, sort of.

BL> What's a one-byte buffer called?

Pass.  Who's using a 1-byte buffer?  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™.