Computer Science Canada

really weird thing with file io

Author:  MysticVegeta [ Sun Feb 13, 2005 8:00 pm ]
Post subject:  really weird thing with file io

really weird thing happens
when i go something like this ->

code:
%Declaring the variables
var input : array 1 .. 5 of string
var lines : array 1 .. 5 of string
var stream : int

%Creating File
open : stream, "txtfile.txt", put
put : stream, "11"
close (stream)

%Get part
for x : 1 .. 5
    get input (x)
end for

%The main loops
open : stream, "txtfile.txt", get
for x : 1 .. 5
    get : stream, lines (x) : *
end for
close (stream)

put "exit"


But in the "main loop", when i add

code:
exit when eof


It actually "gets" the stream int, like asks for 6 inputs!! How do i make it so that it exits after eof

Author:  1337_brad [ Sun Feb 13, 2005 8:06 pm ]
Post subject:  well..

If you put everything as you did, it should be

code:

exit when eof(stream)


: