I keep getting this error...
Author |
Message |
xmdxtreme
|
Posted: Thu May 27, 2004 11:27 pm Post subject: I keep getting this error... |
|
|
can someone help me with this problem plz
code: |
procedure pay
var file : int
var entry : entryType
% Open the file, seek to the beginning of the
% record and read the entry.
open : file, accountFileName, read, seek
assert file > 0
loop
read : file, entry
put entry.name
exit when eof (file)
end loop
put "(Press any key to continue)" ..
close : file
end pay
|
ok heres the problem when the file is empty it give a variable has no value error i dont want this to happen |
|
|
|
|
|
Sponsor Sponsor
|
|
|
guruguru
|
Posted: Fri May 28, 2004 3:12 pm Post subject: (No subject) |
|
|
In the loop, you are assigning something to a variable that isnt there. Then you check to see if the file is empty. Put the "exit when eof (file)" line at the beggining of your loop and it should work perfect. As well, I don't think you need seek there, because you never use it. (Maybe you didnt post the full code... trickzy... :p).
code: |
procedure pay
var file : int
var entry : entryType
% Open the file, seek to the beginning of the
% record and read the entry.
open : file, accountFileName, read, seek
assert file > 0
loop
exit when eof (file)
read : file, entry
put entry.name
end loop
put "(Press any key to continue)" ..
close : file
end pay
|
|
|
|
|
|
|
xmdxtreme
|
Posted: Fri May 28, 2004 8:13 pm Post subject: (No subject) |
|
|
thanks it worked and the seek part yeah i didnt paste the whole code just the part i needed help with |
|
|
|
|
|
|
|