Re: EUPHORIA Digest - 10 Apr 1998 to 11 Apr 1998
- Posted by Jeff Zeitlin <jeff.zeitlin at MAIL.EXECNET.COM> Apr 12, 1998
- 781 views
On Sun, 12 Apr 1998 00:00:15 -0500, ST Qu Man <STQuMan at AOL.COM> wrote: >I have been doing pretty good in converting over between the two = languages, >but I'm stuck on how to transfer the following basic chunk to a Euphoria >chunk. >OPEN "c:\file.txt" FOR OUTPUT AS #1 >DO >IF EOF(1) THEN GOTO 1090 >LINE INPUT #1, d$ >PRINT d$ >LOOP >1090 SLEEP >END There's what appears to be a major bug here - are you sure you want C:\FILE.TXT to be open for _output_? The rest of the code suggests that it should be for _input_. On that assumption, and on the assumption that the SLEEP in 1090 is to wait for a keypress... Really, what you're doing is reading each line of the file and printing it to the screen - essentially, the equivalent of the DOS built-in TYPE command. I would write this as: atom f object d atom k f =3D open("c:\\file.txt","r") d =3D gets(f) while not atom(d) do puts(1,d & "\n") d =3Dgets(f) end while k =3D wait_key() -- Jeff Zeitlin jeff.zeitlin at mail.execnet.com