1. Extra lines?

------=_NextPart_000_000E_01C002F5.FCE0AE00
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm taking peoples advice and reading (and fiddling with) all of the =
demos in the Euphoria package. It's actaully a lot of fun, but I've run =
across the unknown again. Here's the program and some questions:


integer fn,lines,c

fn =3D open("tutorial.doc","r")
if fn=3D-1 then
puts(1,"I'm sorry Dave, I can't do that.")                        -- =
Anyone recognize this?
abort(1)                                                                 =
   -- What is the (1) for? Is there a (2)?
end if
lines=3D0
while 1 do
c=3Dgetc(fn)                                                             =
   -- Was is 'getc' I can't find it in the HTML or in ABGTE2.
if c=3D-1 then
exit
end if
if c=3D '\n' then
lines=3Dlines+1
end if
end while

? lines
close(fn)                                                                =
-- Is this line simply to finish the integer fn to free up memory, if =
so, why not                                                              =
                                                                         =
                              the others?
=20
That's all for now.......

bye
-Thomas

=20

------=_NextPart_000_000E_01C002F5.FCE0AE00
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm taking peoples advice and reading =
(and fiddling=20
with) all of the demos in the Euphoria package. It's actaully a lot of =
fun, but=20
I've run across the unknown again. Here's the program and some=20
questions:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>integer fn,lines,c</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>fn =3D open("tutorial.doc","r")<BR>if =
fn=3D-1=20
then<BR>puts(1,"I'm sorry Dave, I can't do that.")&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; -- Anyone recognize =
this?<BR>abort(1)&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; --=20
What is the (1) for? Is there a (2)?<BR>end if<BR>lines=3D0<BR>while 1=20
do<BR>c=3Dgetc(fn)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; -- Was is 'getc' I can't find it in the HTML or in=20
ABGTE2.<BR>if c=3D-1 then<BR>exit<BR>end if<BR>if c=3D '\n'=20
then<BR>lines=3Dlines+1<BR>end if<BR>end while</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>? lines<BR>close(fn)&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- Is this line =
simply=20
to finish the integer fn to free up memory, if so, why not =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; the=20
others?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>That's all for now.......</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>bye</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Thomas</FONT></DIV>

------=_NextPart_000_000E_01C002F5.FCE0AE00--

new topic     » topic index » view message » categorize

2. Re: Extra lines?

I'm taking peoples advice and reading (and
fiddling with) all of the demos in the Euphoria
package. It's actaully a lot of fun, but I've run
across the unknown again. Here's the program and
some questions:


integer fn,lines,c

fn = open("tutorial.doc","r")
if fn=-1 then
puts(1,"I'm sorry Dave, I can't do that.")
                        -- Anyone recognize this?
abort(1)
        -- What is the (1) for? Is there a (2)?
        --Anything other than a 0 tells the os
        --that there was an error
end if
lines=0
while 1 do
c=getc(fn)
          -- Was is 'getc' I can't find
                --it in the HTML or in ABGTE2.

                --get character, check in file
                --routines of library.html
if c=-1 then
exit
end if
if c= '\n' then
lines=lines+1
end if
end while

? lines
close(fn)
        -- Is this line simply to finish the
        --integer fn to free up memory, if so,
        --why not

        --If the program has made it this far
        --than fn is an open file and needs
        --to be closed

the others?

That's all for now.......

bye
-Thomas



I hope this helps.

-E.Allen Soard

Bookmark the HyperMart Small Business Center. All the tools you need to
succeed!
http://www.hypermart.net/center/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu