BBS: Inland Empire Archive
Date: 11-01-92 (20:31) Number: 338
From: MICHAEL JONES Refer#: NONE
To: BOB LAPIERRE Recvd: NO
Subj: Command Line Switches Conf: (2) Quik_Bas
on Oct 28, 92 Bob Lapierre 1:3611/15 you were saying that...
BL>I am trying to figure out, How can you make a Compiled QB4.5 program
BL>recognize command line switches at the DOS prompt? If anyone could
BL>me out, I would greatly appreciate it.
I do not have any code handy. If I remember right the
example that comes with QB was hard to follow. At least it
was a few years ago. :-)
What you first want to do is to get the command line with the COMMAND$
TheCommandLine$ = COMMAND$
Then what I do (probably is not necessary) is I force it to
upper case and strib the spaces off of the right and left.
Maybe QB does this already, I never checked.
TheCommandLine$ = UCASE$(RTRIM$(LTRIM$(TheCommandLine$)))
Then you want to set up a FOR NEXT LOOP. This might need
work, I'll rush through it.
Flag% = 0
TheSwitch$ = ""
TheRest$ = ""
FOR I = 1 TO LEN(TheCommandLine$)
Tmp$ = MID$(TheCommandLine$, I, 1)
IF Tmp$ = " " THEN
Flag% = 1
TheRest$ = TheRest$ + Tmp$
TheSwitch$ = TheSwitch$ + Tmp$
That should be all that you need. I usually require a - for the switch
and afterward check for it but that is really not necessary.
--- QM v1.00
* Origin: Shelter From The Storm (404)518-1356 (1:133/115.0)