Qbasicnews.com

Full Version: Using remark as data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have found a way(a very simple way) of using remarks in a program you are running. Here is the code

Code:
REM 1-2-3-4
REM 5-6-7-8
REM 9-10-11-12
CLS

OPEN "rem.bas" FOR INPUT AS #1
LINE INPUT #1, A$
CLOSE #1

PRINT MID$(A$, 45, 7)
PRINT MID$(A$, 55, 7)
PRINT MID$(A$, 65, 10)

This works well but is very hard to use or get to work from nothing. Does anyone know about this or can anyone help me with understanding it. Also try typing in.
Code:
Print A$
This gets a very strange response.
Why would you use that when you can...

1. Use another file for data,
2. Append data at the end of the exe?
I think DATA/READ would be better for what you're trying to do:

Code:
DATA 1, 2, 3, 4
DATA 5, 6, 7, 8
DATA 9, 10, 11, 12
CLS

FOR i = 1 TO 12
  READ a
  PRINT a
NEXT

(You could actually generate the numbers with the FOR loop, but I'm guessing you just picked those numbers for an example and intend to use different ones in your actual program...)
Your source must have been saved in tokenized form rather than ASCII.