Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 really weird thing with file io
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MysticVegeta




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
1337_brad




PostPosted: 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)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: