Page 1 of 1

Passing values to QBasic programs

Posted: Thu Oct 21, 2004 7:20 am
by WmFS
Is it possible to pass values accessable to QBasic programs at runtime?

For example, of program READ.BAS is used to read records from a data file specified by the user. It might begin like this:

1000 INPUT "Give File Name ", D$
1010 OPEN D$ FOR INPUT AS #1
1020 .......

When executed by

QBASIC /RUN READ

the user will be prompted to supply a file name.

My question is, can this file name be suppied at the QBASIC call, eg:

QBASIC /RUN READ(filename)

Thanks.

Bill

Posted: Thu Oct 21, 2004 9:37 am
by Stormy
Maybe you want to something like this:

The Command you started the program:

Code: Select all

QBASIC /RUN Chooser.bas File01.bas
Code in Chooser.bas:

Code: Select all

OPEN COMMAND$ FOR INPUT AS #1
READ #1, a$
CLOSE #1
OR:

Code: Select all

RUN COMMAND$
You only just use the parameter for your handling.