Communicate with self-writing program!

Status
Not open for further replies.

Spectrum

Registered Senior Member
To be run under QBasic.
THAT$=[FILENAME]
STRT:
DO
OPEN THAT$ FOR APPEND AS #1
PRINT #1, TIME$
CLOSE
OPEN THAT$ FOR RANDOM AS #1 LEN = 1
FOR LETTER&=1 TO LOF(1)
FIELD #1, 1 AS LETTER$
GET #1, LETTER&
PUT #1, LOF(1)+LETTER&
NEXT LETTER&
CLS
SHELL "TYPE " + THAT$
KILL THAT$
INKEY$
LOOP WHILE INKEY$<>CHR$(27)
NPT:
LINE INPUT ">", LINE$
IF LINE$="" THEN GOTO STRT
OPEN THAT$ FOR APPEND AS #1
PRINT #1, LINE$
CLOSE
OPEN THAT$ FOR RANDOM AS #1 LEN = 1
FOR LETTER&=1 TO LOF(1)
FIELD #1, 1 AS LETTER$
GET #1, LETTER&
PUT #1, LOF(1)+LETTER&
NEXT LETTER&
CLOSE
SHELL "TYPE " + THAT$
KILL THAT$
GOTO NPT
Please try this program so I can get some feedback. What do you all think? The random letters are created by the file reading through 'THAT$' (a user specified file) and appending the file with 'each letter'.However by the time the file reaches 'the end' the Length-Of-File has grown with each PUT, so then each of these letters is taken and PUT at the Length-Of-File + letter&(!) In theory the program should never actually reach the end of the file, but it does.
To converse with the program simply press escape. To leave the conversation press enter when prompted. Thanks.
 
Last edited:
Status
Not open for further replies.
Back
Top