Board index » delphi » Reading records/Writing to ASCII file

Reading records/Writing to ASCII file

I want to read some data contained in a a field and then write the values in
the field to an ASCII file....BUT I haven't been able to work it out.  Any
suggestions would be great.  Feel free to e-mail me at my return address.

Thanks.  Campbell Thompson

 

Re:Reading records/Writing to ASCII file


Campbell D Thompson <c...@kuhub.cc.ukans.edu> wrote:

Quote
>I want to read some data contained in a a field and then write the values in
>the field to an ASCII file....BUT I haven't been able to work it out.  Any
>suggestions would be great.  Feel free to e-mail me at my return address.
>Thanks.  Campbell Thompson

Your best bet is to look at the on-line help (I know, I know) under
I/O routines.  Text files are accessed by the following procedure:

Declare a Text file variable
begin try block
assign the variable to a filename
'reset' (to open) or 'rewrite' to create the file
'readln' and 'writeln' to read / write lines of text from/to the file
finally block
CloseFile to close the file & free the handle

note:  the actual file access should be enclosed in a try...finally
block, with the CloseFile command issued regardless of file I/O
errors.

Other Threads