[Site Home] [Forum Home] [Articles] [File DB] [News Archives]

Programming -> Stream I/O


(View original topic)


Shmack - May-25-2005 server time
nvm found some thin

% File I/O
% Basic code
%
% On their own, these pieces don't work, but
% they should be the basis for your file I/O



% Write to a file
var stream : int

% Open a stream to write data to a file
% (can replace filename with real name in quotes)
open : stream, filename, put

% Write the data to the file
put : stream, data

% Close the stream
close : stream



% Read from a file
var stream : int

% Open a stream to read data from a file
% (can replace filename with real name in quotes)
open : stream, filename, get

% Make sure stream is given a value
% (file exists)
assert stream > 0

% Read data in using a loop
loop
% Get out of the loop if we've reached the End Of File
exit when eof (stream)

% Read the data from the file
get : stream, data

% Display it to the screen
put data
end loop

% Close the stream
close : stream


thx any ways

Shmack - May-25-2005 server time
right now im learning I/O and i currently dont know what to do lol i looked in the help fild but im supposed to creat a .txt save in it and display info from it if you know any thing could you help me out a little unsure.gif

(Showing 50 last posts, newest on top)