I have found that i can use something called a launcher in linux by right clicking the desktop.
i have set this to run my program in the terminal which i am happy about but i want to give it some default values when it runs.
Im guessing i should put the values after the program path with – befor them but im not sure about what im doing.
can some point me to a document or something that lists the ways to include values and what i can include in the path.
also if i do this how will my program read them ? will they be passed to main ?
Is it possible to set it up in a way that the program does not know how many variables are coming at start up but will read as many as it gets.
im using c++.
If I recall correctly running a terminal is something like
-e command arg … command to execute
So create a file named myApp.sh (pretty much an equivalent of a .bat on windows)
enter the following:
After saving, just chmod +x on the file (so Linux will consider it as an executable)
After this, you can run it from anywhere on your machine (if the dir is in the PATH enviroment variable) or via double click in Gnome File Manager.
If you need to pass args also to the shell, you can access every single param with
$0, $1, $2 (equivalents to %1, %2 in MS batch).
For command lines, a C/C++ program starts usually with a function main
argc is the number of arguments received in input, while argv is a pointer to an array of char * (the actual commandline), you may parse ’em directly.
PS: note that I use rxvt, you probably want to change this to xterm o gterm or whatever terminal you prefer to use.