Small Problem

new topic     » 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 =3D "0"
arg1 =3D "0"
arg2 =3D "0"
arg3 =3D "0"
fn =3D0
fn =3D open("example.dat", "r")
 if fn =3D -1
 then
message =3D message_box(   "Where is example.dat?\n"&"Program is=
 shutting down!","Missing Dat File" , MB_ICONHAND+MB_TASKMODAL )
 closeWindow(MainWin)
 else
   temp =3D gets(fn)
      command =3D temp[1..length(temp) - 1]
   temp =3D gets(fn)
      arg1 =3D temp[1..length(temp) - 1]
   temp =3D gets(fn)
      arg2 =3D temp[1..length(temp) - 1]
  temp =3D gets(fn)
      arg3 =3D 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=3D-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     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu