Menu

Program execution with parameters

2002-12-21
2012-09-26
  • Nobody/Anonymous

    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.

     
    • Nobody/Anonymous

      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

       
    • Nobody/Anonymous

      Oh sorry, what menu bar, isn't it in compiler options? And there is checkbox what has to be checked.

      tkorrovi

       
    • Derek Baker

      Derek Baker - 2002-12-21

      Isn't he referring to Parameters on the Execute menu?

      Derek

       
    • Nobody/Anonymous

      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

       
    • Derek Baker

      Derek Baker - 2002-12-21

      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

       
    • Nobody/Anonymous

      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-

       
    • Nobody/Anonymous

      Can you post your code?

      Wayne

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.