Re: Read & Write Binary Files
The only thing that is really different about binary files, is how you open them
and you can't or shouldn't use gets(). gets() is meant for reading in lines of
text and will remove certain characters. Binary files dont have 'lines'.
sequence data
integer fn,c
fn = open("file.dat","rb") -- open for binary reading
if fn != -1 then
data = {}
c = getc(fn)
while c != -1 do -- until we reach EOF (-1)
data &= c
c = getc(fn)
end while
close(fn)
end if
Writing to a binary file is exactly the same as in text mode.
Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~
http://empire.iwireweb.com - Empire for Euphoria
|
Not Categorized, Please Help
|
|