|
sda Wanderer
Joined: 18 Apr 2001 Posts: 55 Location: United Kingdom
|
Posted: Tue Jul 09, 2002 12:01 am
Reading text data from file into variable |
Howdy folks, I don't often post here but I now have a small issue...
Using 6.x, I can't work out how to read a list of names (one per line) from a text file into a string list/variable. I can't work out the form of the #READ command, and could you say,.... loop until EOF?
Thanks,
Steve :) |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Jul 09, 2002 3:00 am |
Int that case you want to use the %read function.
Protcode follows:
#FILE 1 "textfile.txt"
#LOOP 1,%filesize(1) {#ADDITEM ListVariable {%read(1,0)}} |
|
|
|
sda Wanderer
Joined: 18 Apr 2001 Posts: 55 Location: United Kingdom
|
Posted: Wed Jul 10, 2002 12:22 am |
Thankyou very much!
|
|
|
|
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Wed Jul 10, 2002 8:39 pm |
Or... if you want to do it all at one go:
#FILE 1 "textfile.txt"
#VAR ListVariable %grep(1, "%*")
#CLOSE 1
- Charbal |
|
|
|
|
|