Re: Using ProgramParameter
Posted: Sun Dec 04, 2011 1:18 pm
Please try my following working code example. If you want to test
the example from the IDE you need to use OpenConsole(). Otherwise
you can delete it.
In order to start my example in a console you have to change the
"Executable format" in "Compiler/Compiler Options..." from "MacOS"
to "Console" before compiling and saving the example.
Before starting the compiled example you have to start a console
("Terminal"), change into the folder with your compiled "test" program
and start it with
(This is the correct path on my Mac, of course you have to change it
to the correct path on your Mac. Please note that I had to use double
quotes because the path contains a blank in the subfolder "MacOS X".)
the example from the IDE you need to use OpenConsole(). Otherwise
you can delete it.
In order to start my example in a console you have to change the
"Executable format" in "Compiler/Compiler Options..." from "MacOS"
to "Console" before compiling and saving the example.
Before starting the compiled example you have to start a console
("Terminal"), change into the folder with your compiled "test" program
and start it with
An alternative way is to type in the complete path to "test":./test hello world
(This is the correct path on my Mac, of course you have to change it
to the correct path on your Mac. Please note that I had to use double
quotes because the path contains a blank in the subfolder "MacOS X".)
"/Volumes/DATEN/Programmierung/PureBASIC/Beispiele/MacOS X/Downloads/Konsole/test1" hello world
Code: Select all
If OpenConsole()
If CountProgramParameters() = 0
PrintN("No program parameters detected!")
Else
For i = 0 To CountProgramParameters() - 1
PrintN(ProgramParameter(i))
Next
EndIf
PrintN("")
PrintN("Press <Enter> to continue...")
Input()
EndIf