Help With An Error

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

Hi All,
I have a small problem I need help with. I have a procedure that=
 opens a file and
reads text from four separate lines. Example:

procedure int_command()
sequence command, port,arg1,arg2,arg3,temp
integer fn, message
command = "0"
arg1 = "0"
arg2 = "0"
arg3 = "0"
fn =0
fn = open("example.dat", "r")
if fn = -1
then
message = message_box(   "Where is example.dat?\n"&"Program is=
 shutting
down!","Missing Dat File" , MB_ICONHAND+MB_TASKMODAL )
closeWindow(MainWin)
else
 temp = gets(fn)
    command = temp[1..length(temp) - 1]
 temp = gets(fn)
    arg1 = temp[1..length(temp) - 1]
 temp = gets(fn)
    arg2 = temp[1..length(temp) - 1]
temp = gets(fn)
    arg3 = temp[1..length(temp) - 1]
    close(fn)
   end if
end procedure

It works okay if there are four lines to read, but if the file=
 only has three or less
lines I get an error: type_check failure, temp is -1

If I use:
if temp=-1 then =85ect..ect....   I get an error: true/false=
 condition must be an
ATOM

Any suggestions from preventing the type_check error?

Thanks,
Chris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu