
-----------------------------------
xmdxtreme
Thu May 27, 2004 11:27 pm

I keep getting this error...
-----------------------------------
can someone help me with this problem plz

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  :oops:

-----------------------------------
guruguru
Fri May 28, 2004 3:12 pm


-----------------------------------
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).


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
Fri May 28, 2004 8:13 pm


-----------------------------------
thanks it worked and the seek part :P yeah i didnt paste the whole code just the part i needed help with :lol:
