[comp.sys.mac.programmer] Read/Write data

gt4586c@prism.gatech.EDU (WILLETT,THOMAS CARTER) (09/18/90)

A great I/O question:  why is it that i can write data out to a file
using WRITELN much, much faster than i can read it back in using READLN?
Would it be better to be using FSRead and FSWrite when writing data to
a textfile?
For reference i'm using Think Pascal 3.0 on a Mac IIci with a Quantum 105MB
internal drive (19ms).


-- 
thomas willett 
Georgia Institute of Technology, Atlanta  
gt4586c@prism.gatech.edu
"Violence is the last refuge of the incompetent." - Salvor Hardin (Foundation)

anderson@Apple.COM (Clark Anderson) (09/18/90)

From: gt4586c@prism.gatech.EDU (WILLETT,THOMAS CARTER):
>A great I/O question:  why is it that i can write data out to a file
>using WRITELN much, much faster than i can read it back in using READLN?
>Would it be better to be using FSRead and FSWrite when writing data to
>a textfile?

It all depends on how Symantec implemented the READLN and WRITELN procedures.
Reading from a file means maintaining a buffer, handling end-of file
conditions, etc. Writing to a file is usually just doing a FSWrite to it.
There is a little bit more to be done, but not a whole lot.

Doing FSRead/Write yourself is more direct. Also, you can write to any directory
you like, whereas READLN and WRITELN limit you to the directory that your
application or project is in.
                                          --clark
-- 
-----------------------------------------------------------
Clark Anderson                InterNet:  anderson@apple.com
PCB Software Tools            AppleLink: C.ANDERSON
Apple Computer, Inc           BellNet:   408-974-4593

"I speak only for myself, much to my employer's relief..."
-----------------------------------------------------------