[comp.sys.apple2] Text files & BASIC

bill@pro-gateway.cts.com (Bill Long, SysOp) (06/25/91)

Is there a way, in AppleSoft BASIC, to READ from a text file for a while,
then pause reading for a while and take input from the keyboard and put
output to the screen, and then continue READing from where you left off?

Thanx.

----
Internet: bill@pro-gateway.cts.com

David.Empson@actrix.gen.nz (David Empson) (06/25/91)

In article <1991Jun25.050640.19679@crash.cts.com> bill@pro-gateway.cts.com (Bill Long, SysOp) writes:
> Is there a way, in AppleSoft BASIC, to READ from a text file for a while,
> then pause reading for a while and take input from the keyboard and put
> output to the screen, and then continue READing from where you left off?
> 
> Thanx.
> 
> ----
> Internet: bill@pro-gateway.cts.com

To stop reading from a text file, do any ProDOS command, using PRINT
D$.  For example:

10 D$=CHR$(4)
20 PRINT D$;"OPEN TEXTFILE"
30 PRINT D$;"READ TEXTFILE"
40 INPUT L$: REM L$ is read from the text file
50 PRINT D$: REM stop reading from the text file
60 INPUT "What next? ";A$: REM this will read from the keyboard
70 IF A$<>"STOP" THEN GOTO 30
80 PRINT D$;"CLOSE"
-- 

David.Empson@bbs.actrix.gen.nz

curtis@achilles.ctd.anl.gov (Jeffrey Curtis ) (06/25/91)

In article <1991Jun25.050640.19679@crash.cts.com> bill@pro-gateway.cts.com (Bill Long, SysOp) writes:
>Is there a way, in AppleSoft BASIC, to READ from a text file for a while,
>then pause reading for a while and take input from the keyboard and put
>output to the screen, and then continue READing from where you left off?

Well, you could do it with pseudo-machine language (ie, make CALLs or PEEKs
to certain registers), but I'm assuming you don't want to get that messy.
It CAN be done; it's just a matter of resetting a pointer away from the file
and back to the keyboard; this causes all INPUT commands to read from the
console, but the problem is I don't know if there's an official way to do it
in BASIC/DOS or not.  Anyone else know how to do this?  If not, I'll post
a quickie in a few days showing you how to do it a few different ways with
CALLs, PEEKs, and POKEs..

*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
+ Jeffrey S. Curtis (708)972-8585 B41801 AT ANLVM curtis@achilles.ctd.anl.gov +
*        Computing and Telecommunications, Argonne National Laboratory 	      *
+ Want a free copy of Heatseeker, the Apple's fastest disk utility?  Mail me! +
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*

mdavis@pro-sol.cts.com (Morgan Davis) (06/26/91)

In-Reply-To: message from bill@pro-gateway.cts.com

Just a PRINT CHR$(4) before your INPUT statement.  That turns off file
input.  To get file input again, use another READ command:

        PRINT CHR$(4)"READ FILE"
        INPUT FILEIN$
        PRINT CHR$(4)
        INPUT USERIN$
        PRINT CHR$(4)"READ FILE"
        INPUT FILEIN$
        ...

UUCP: crash!pro-sol!mdavis           AOL, BIX: mdavis  
ARPA: crash!pro-sol!mdavis@nosc.mil  GEnie:    m.davis42
INET: mdavis@pro-sol.cts.com         ProLine:  mdavis@pro-sol