
-----------------------------------
skier
Fri Nov 12, 2004 3:56 pm

calling info from text files
-----------------------------------
does anyone no how to get arrays t save to a text file.i have got it to do single numbers but i cant get it to do arrays.


var fileName : string := "filename.txt" 
var file : int 
var s : string 
var num:int
num:= 5

open : file, fileName, put 
put : file, num
close (file) 

open : file, fileName, get 
get : file, s : * 
put s
close (file) 


any help?

-----------------------------------
Tony
Fri Nov 12, 2004 4:05 pm


-----------------------------------
well just keep on writing to file and not close it...

for i : 1 .. upper (my_array)
    put : file, my_array (i)
end for


-----------------------------------
skier
Fri Nov 12, 2004 4:14 pm


-----------------------------------
thats what i was doing before and it wasnt working but now it is. maybe i frogot to put in "upper".

how do i call all the info for an array.i tyed just calling th variable but it doesnt work.how do i do this ?

-----------------------------------
Mr. Glib
Sun Nov 14, 2004 3:27 pm

Re: calling info from text files
-----------------------------------
does anyone no how to get arrays t save to a text file.i have got it to do single numbers but i cant get it to do arrays.

snip


any help?

With arrays, remember those pesky little index values.

var x : array 1..2 of int
x(1) :=10
x(2) :=3

open : stream, filename, put

for y : 1..2
  put : stream, x(y)
end for
