Hi,<br>
using Dev-c++ 4.9.7.0. How can I start my program with command line parameters from within dev-c++ after compilation? My way of entering a parameter in the menu bar and the executing and starting the program by ctrl-f10 simply ignores those parameters.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
int main (void) {/*...*/}
int main (int argc, char *argv []) {/*...*/}
Function called at program startup in hosted environment is named main. It can also be defined with parameters argc and argv (any names may be used). If argc is greater than zero, array members argv [0] through argv [argc-1] contain pointers to strings what represent program parameters. String pointed to by argv [0] represents program name, argv [argc] is null pointer. Return from initial call to main is equivalent to calling exit with value returned by main as argument.
This is part of c89 description I wrote on 20 pages.
tkorrovi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes Derek, I thought he was. If you go to the Execute menu, the third item on the menu is Parameters, which gives you a place to put in "Parameters to pass to your program".
Note I do not see a shortcut to it involving F keys...
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi again,
okay, sorry for the missunderstandings. As you suspected, I enter the program parameters in the execute menu. Then, when i try to execute the program (still: hotkey ctrl-f10 ;-) ) those parameters are not passed to the program. What the heck am i doing wrong?
-Millhiller-
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,<br>
using Dev-c++ 4.9.7.0. How can I start my program with command line parameters from within dev-c++ after compilation? My way of entering a parameter in the menu bar and the executing and starting the program by ctrl-f10 simply ignores those parameters.
int main (void) {/*...*/}
int main (int argc, char *argv []) {/*...*/}
Function called at program startup in hosted environment is named main. It can also be defined with parameters argc and argv (any names may be used). If argc is greater than zero, array members argv [0] through argv [argc-1] contain pointers to strings what represent program parameters. String pointed to by argv [0] represents program name, argv [argc] is null pointer. Return from initial call to main is equivalent to calling exit with value returned by main as argument.
This is part of c89 description I wrote on 20 pages.
tkorrovi
Oh sorry, what menu bar, isn't it in compiler options? And there is checkbox what has to be checked.
tkorrovi
Isn't he referring to Parameters on the Execute menu?
Derek
Yes Derek, I thought he was. If you go to the Execute menu, the third item on the menu is Parameters, which gives you a place to put in "Parameters to pass to your program".
Note I do not see a shortcut to it involving F keys...
Wayne
No F key for Paramteres. He says he puts it in Paramters, then Ctrl-F10's to run the program. Which apparently does take those parameters.
Derek
Hi again,
okay, sorry for the missunderstandings. As you suspected, I enter the program parameters in the execute menu. Then, when i try to execute the program (still: hotkey ctrl-f10 ;-) ) those parameters are not passed to the program. What the heck am i doing wrong?
-Millhiller-
Can you post your code?
Wayne