1. Small Problem

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 message » categorize

2. Re: Small Problem

LOL!!! What is up with this mailing list? I originally sent this=
 message out yesterday. Now that is a delay :)

Chris


>
>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")
>=A0if fn =3D -1
>=A0then
>message =3D message_box( =A0 "Where is example.dat?\n"&"Program is
>shutting down!","Missing Dat File" , MB_ICONHAND+MB_TASKMODAL )
>=A0closeWindow(MainWin)
>=A0else
>=A0=A0temp =3D gets(fn)
>=A0=A0=A0command =3D temp[1..length(temp) - 1]
>=A0=A0temp =3D gets(fn)
>=A0=A0=A0arg1 =3D temp[1..length(temp) - 1]
>=A0=A0temp =3D gets(fn)
>=A0=A0=A0arg2 =3D temp[1..length(temp) - 1]
>=A0temp =3D gets(fn)
>=A0=A0=A0arg3 =3D temp[1..length(temp) - 1]
>=A0=A0=A0close(fn)
>=A0=A0=A0end if
>=A0end 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:
>=A0if temp=3D-1 then =85ect..ect.... =A0 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 message » categorize

3. Re: Small Problem

The answer is quite simple.

In order to prevent overrunning of the list, we, in cooperation with Albert
Einstein, Stephen Hawkings,
and the late Douglas Adams, have created a feature by which the user may receive
the answer to their
question before asking the question, thereby negating the need to ask the
question.  Our patented
Casuality Effect 8-ball® system here at Topica is state of art, although it has
not been invented yet.  To
obtain this high technology, we used the Causuality Effect 8-ball® to download
the Causuality Effect 8-
ball®, which we used to download the Causuality Effect 8-ball®, which we used to
download the Causuality
Effect 8-ball®.


Mr. Manager
Topica
June 27, 2032


6/27/2002 1:36:07 PM, Christopher B <president at insight-concepts.com> wrote:

>
>LOL!!! What is up with this mailing list? I originally sent this message out
>yesterday. Now that is a
delay :)
>
>Chris
>
>
>>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 ?ect..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 message » categorize

4. Re: Small Problem

Use:
  if atom(temp) then ...

the gets() function returns a sequence for data, and an atom for no
data.  Alternately, you can also do this to avoid the type-check errors
in the first place:
  if sequence(temp) then doodah = temp[1..n] end if

HTH,
Michael J. Sabal

>>> president at insight-concepts.com 06/25/02 05:09PM >>>

If I use:
 if temp=-1 then .ect..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 message » categorize

5. Re: Small Problem

:) On Thu, 27 Jun 2002 14:24:10 -0600, Travis Beaty wrote: > >The answer is quite simple. > >In order to prevent overrunning of the list, we, in cooperation= with >Albert Einstein, Stephen Hawkings, >and the late Douglas Adams, have created a feature by which the= user >may receive the answer to their >question before asking the question, thereby negating the need= to >ask the question. =A0Our patented >Casuality Effect 8-ball=AE=A0system here at Topica is state of art, >although it has not been invented yet. =A0To >obtain this high technology, we used the Causuality Effect= 8-ball=AE >to download the Causuality Effect 8- >ball=AE, which we used to download the Causuality Effect 8-ball=AE, >which we used to download the Causuality >Effect 8-ball=AE. > > >Mr. Manager >Topica >June 27, 2032 > > >6/27/2002 1:36:07 PM, Christopher B= <president at insight-concepts.com> >wrote: > >> >>LOL!!! What is up with this mailing list? I originally sent= this >>message out yesterday. Now that is a >delay :) >> >>Chris >> >> >>>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") >>>=A0if fn =3D -1 >>>=A0then >>>message =3D message_box( =A0=A0"Where is example.dat?\n"&"Program= is >>>shutting down!","Missing Dat File" , MB_ICONHAND+MB_TASKMODAL= ) >>>=A0closeWindow(MainWin) >>>=A0else >>>=A0=A0temp =3D gets(fn) >>>=A0=A0=A0command =3D temp[1..length(temp) - 1] >>>=A0=A0temp =3D gets(fn) >>>=A0=A0=A0arg1 =3D temp[1..length(temp) - 1] >>>=A0=A0temp =3D gets(fn) >>>=A0=A0=A0arg2 =3D temp[1..length(temp) - 1] >>>=A0temp =3D gets(fn) >>>=A0=A0=A0arg3 =3D temp[1..length(temp) - 1] >>>=A0=A0=A0close(fn) >>>=A0=A0=A0end if >>>=A0end 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: >>>=A0if temp=3D-1 then ?ect..ect.... =A0=A0I 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 message » categorize

6. Re: Small Problem

On 27 Jun 2002, at 14:24, Travis Beaty wrote:

> 
> The answer is quite simple.
> 
> In order to prevent overrunning of the list, we, in cooperation with
> Albert Einstein, Stephen Hawkings, and the late Douglas Adams, have
> created a feature by which the user may receive the answer to their
> question before asking the question, thereby negating the need to ask
> the question.  Our patented Casuality Effect 8-ball=AE system here at
> Topica is state of art, although it has not been invented yet.  To
> obtain this high technology, we used the Causuality Effect 8-ball=AE to
> download the Causuality Effect 8- ball=AE, which we used to download the
> Causuality Effect 8-ball=AE, which we used to download the Causuality
> Effect 8-ball=AE.
> 
> 
> Mr. Manager
> Topica
> June 27, 2032
> 
> 
Or maybe they used S.Ma.R.T.Y. system, i.e. Send Mail Redundantly To 
You. ;)

-- Euler

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu