Can I take the entire console and save it as a string variable?

72 Views Asked by At

I'm trying to take the entire console text at the end of the program and save it as a string variable. Then after I will take the string variable and save it as a text document. What would be the best way to tackle this obstacle? Thank you!

1

There are 1 best solutions below

0
Sir Jo Black On

I think this solution might help to solve your question.

The Qbasic code below requires a text file to read, it reads and prints on the screen the first nine line of the file, then copies the contents of the first ten screen line in the second half of the console reading the chars from the screen memory.

SCREEN 0

INPUT "File name: ", fname$

OPEN fname$ FOR INPUT AS #1

x = 9
WHILE NOT EOF(1) AND x <> 0
  INPUT #1, x$
  PRINT x$
  x = x - 1
WEND
CLOSE #1

PRINT "----------------------------------"

REM HERE THE PROGRAM READS THE SCREEN
LOCATE 12, 1
FOR y = 1 TO 10
  FOR x = 1 TO 80
    PRINT CHR$(SCREEN(y, x, 0));
  NEXT x
NEXT y