TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Paul Edwards
from: Bob Lawrence
date: 1996-11-29 09:23:20
subject: tic

BL> I wonder what I've been doing wrong? I always end up with an
 BL> extra cr/lf on the end.

 PE> Do a hexdump of the file.

  Gee! What a good idea. Why didn't I think of that? (grin)

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

 PE> They do - they don't need to look for the CRLF at the end of
 PE> the line for when you do fgets(). 

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

 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.

  Doesn't that mean it just calls another function?

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

  What's a one-byte buffer called?

Regards,
Bob


___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 711/934 712/610
@PATH: 711/934

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™.