TIP: Click on subject to list as thread! ANSI
echo: z3_pascal
to: Peter Lavender
from: Glenn Crouch
date: 1996-04-02 06:33:50
subject: reading files

In a message dated 31 Mar 96, Peter Lavender of 3:635/309 wrote:

 PL> Just to fill you in:  I'm doing an Ass.Dip part time, and pascal is the
 PL> laguage we are using, I haven't missed a class for the last semester and
 PL> a bit, but I missed the one about reading and using text files.

 PL> So the question(s) to clear up some confusion from reading the text book
 PL> and hand out.

 PL> 1)  Is it possible to read in and then write to the same file?

Just about anything is possible :-] From a Classic Viewpoint, Text Files are
either read from or written to. Text File Ouput was viewed as an
alternative to screen or printer output. Text File Input was viewed as an
alternative to Keyboard Input.  You can however open a text file as a
binary file and do all the read/write ops you want provided you remember
that (for DOS at least) every line must have a CR/LF (i.e #13 + #10) at the
end...

 PL> 2)  Is it good practise, or possible, to read a textfile in and store the
 PL> info in an array for adding to, deleting, and editing information?

Provided it is an array of strings (or pointer to strings) and that the file
is not too big, then yes by all means process it in memory.

 PL> 3)  Or is an array only for interactive use.. like reading input ask of a
 PL> user?

Arrays can be used however you want them to be used. They are not solely for
"interactive use"

     -Glenn Crouch
      Sysop, Algorithms Anonymous (090) 93-3145 (Australia)
      3:690/643.3
      esbglenn{at}acslink.net.au

---
* Origin: Glenn's Point - Kalgoorlie, West Australia (3:690/643.3)
SEEN-BY: 633/267 270
@PATH: 6430/3 690/643 613 660 711/409 808 50/99 635/544 727 633/267

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