Access to command line arguments
Brought to you by:
kerravon86,
tcamp
I'd like to have access to command line arguments inside a bwbasic program. So I could type this command line:
$ bwbasic cc.bas myprog.c
And write a program cc.bas to access the "myprog.c" parameter like this:
open args$(1) for input as #1
The exact variable name (args$ versus argv$) isn't important to me as long as it is possible to do it.
Bill,
My apologies for the delay. I've been offline for many months. Does the following work for you?
FOR X = 0 TO 9
LET S$ = COMMAND$(X)
PRINT "COMMAND$("; X; ")="; S$
NEXT X
If the above code is placed in the file "command4.bas", then
C:\DOS\BWB32>bwbasic.exe command4.bas something
COMMAND$( 0 )=command4.bas
COMMAND$( 1 )=something
COMMAND$( 2 )=
COMMAND$( 3 )=
COMMAND$( 4 )=
COMMAND$( 5 )=
COMMAND$( 6 )=
COMMAND$( 7 )=
COMMAND$( 8 )=
COMMAND$( 9 )=
That looks great! Very cool. Thanks!
If the above code is placed in the file "command4.bas", then
C:\DOS\BWB32>bwbasic.exe command4.bas something
COMMAND$( 0 )=command4.bas
COMMAND$( 1 )=something
COMMAND$( 2 )=
COMMAND$( 3 )=
COMMAND$( 4 )=
COMMAND$( 5 )=
COMMAND$( 6 )=
COMMAND$( 7 )=
COMMAND$( 8 )=
COMMAND$( 9 )=
[feature-requests:#7] Access to command line arguments
Status: open
Group: Next Release (example)
Labels: argv argc
Created: Tue Jun 12, 2018 07:39 PM UTC by Bill Chatfield
Last Updated: Thu Jun 20, 2019 01:25 AM UTC
Owner: nobody
I'd like to have access to command line arguments inside a bwbasic program. So I could type this command line:
$ bwbasic cc.bas myprog.c
And write a program cc.bas to access the "myprog.c" parameter like this:
open args$(1) for input as #1
The exact variable name (args$ versus argv$) isn't important to me as long as it is possible to do it.
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bwbasic/feature-requests/7/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Related
Feature Requests: #7