Menu

#7 Access to command line arguments

open
nobody
argv (1) argc (1)
5
2019-06-20
2018-06-12
No

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.

Related

Feature Requests: #7

Discussion

  • AF5NE

    AF5NE - 2019-06-20

    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

     
  • AF5NE

    AF5NE - 2019-06-20

    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 )=

     
    • Bill Chatfield

      Bill Chatfield - 2019-06-23

      That looks great! Very cool. Thanks!

      On Wednesday, June 19, 2019, 9:29:27 PM EDT, AF5NE <af5ne@users.sourceforge.net> wrote:
      

      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


Log in to post a comment.