Page 1 of 1

Posted: Mon Aug 19, 2002 8:23 pm
by BackupUser
Restored from previous forum. Originally posted by marlo.

I need to call my exe by external parameters, but i dont know how can i work with 2nd or more parameters.

Parameter$ = ProgramParameter()

How can i take the second parameter here if i pass a command line like

myfile.exe firstparameter secondparameter

The firstparameter is Parameter$

Thanks for any help to newbie




from the ass of the world

Posted: Mon Aug 19, 2002 8:53 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

Keep calling ProgramParameter() until it returns an empty string, because each
time it's called, it returns the NEXT parameter. For example:

Code: Select all

Dim p$(99) ; To store parameters (well, up to 99 of them!).
Repeat
  a$=ProgramParameter()
  If a$"" ; Parameter found!
    p=p+1 : p$(p)=a$ ; Add it to the list.
  EndIf
Until a$=""

PB - Registered PureBasic Coder


Edited by - PB on 19 August 2002 21:55:28

Posted: Tue Aug 20, 2002 4:53 pm
by BackupUser
Restored from previous forum. Originally posted by marlo.

Thanks PB!


from the ass of the world