File I/O Difficulty

new topic     » topic index » view thread      » older message » newer message

I am trying to read a file in for alteration on a byte-by-byte level.

-----filedemo.ex
include file.e
include input.e
clear_screen()
sequence s
integer file_i, file_o, seek_success
s =3D input("Enter input path and filename: ")
file_i =3D open(s, "rb")
sequence file_proc
integer file_length
cseek_success =3D seek(file_i,-1)
file_length =3D where(file_i)
seek_success =3D seek(file_i,0)

for x =3D 1 to file_length do
    file_proc[x] =3D getc(file_i)
end for
-----end filedemo.ex

Well, I got an error.

-----ex.err

crypt.ex:15
variable file_proc has not been assigned a value =

=2E..
-----end ex.err

Taking the hint, I then assigned to sequence file_proc to an empty sequen=
ce
before I entered the for loop.  Well, it complained that I was assigning
something to a 0-length sequence.  This makes sense, only I expected my
program would allocate storage dynamicly.

So, would someone please tell me how to resolve this error?  Or, if anyon=
e
has a better suggestion, please let me know too.

Thankx

Alan
 =

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu