xcall LSTLIN, cmdline
LSTLIN may be used within a BASIC program to retrieve the command line from which the program was launched. This is useful for allowing command line parameters to be passed to BASIC programs, and nearly essential for allowing BASIC programs to emulate AMOS LIT commands. It is similar to the BASICplus CMDLIN (or CMDLIN$) system variable, except for the following: 1) LSTLIN does not fold the command line to upper case, like CMDLIN does; and 2) LSTLIN includes the name of the current program, whereas CMDLIN only includes the part of the command line after the program name. The following example will make this distinction clear:
Program LSTLIN,1.0(100)
MAP1 A$,S,100
? "CMDLIN$ = [";CMDLIN$;"] (BASIC Plus only)"
? "CMDLIN = [";CMDLIN;"] (same as CMDLIN$)"
xcall LSTLIN,A$
? "XCALL LSTLIN = [";A$;"]"
If the program above is compiled with COMPLP (or COMPIL /X:1), the command line below will produce the following output:
.run lstlin hello world
CMDLIN$ = [HELLO WORLD] (BASIC Plus only)
CMDLIN = [HELLO WORLD] (same as CMDLIN$)
xcall LSTLIN = [lstlin hello world]
Note that LSTLIN works in all versions of BASIC, while use of the CMDLIN or CMDLIN$ system variable requires BASICplus (complp or compil /x:1).
See Also
• | SBR=LSTLINSTRIP |