Author Topic: running a compiled program with parameters?  (Read 36412 times)

Offline ixfd64

  • Multiple posting newcomer
  • *
  • Posts: 26
    • Facebook
running a compiled program with parameters?
« on: December 18, 2010, 11:29:30 pm »
This is probably a silly question, but:

Suppose that I want to run a program (let's call it "foo") that I just compiled, and that it takes in a parameter ("-bar"). Normally, I would run it by entering "foo -bar" in the command prompt.

However, can someone please tell me how to do the same in Code::Blocks? Obviously, clicking the "run" button only executes the program as "foo" (without the parameters).

Thanks.
« Last Edit: December 18, 2010, 11:31:29 pm by ixfd64 »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: running a compiled program with parameters?
« Reply #1 on: December 19, 2010, 03:36:36 am »
Hi, You should search the forum firstly. or you need to read or search on the C::B manual pdf. http://www.codeblocks.org/user-manual
I just search the forum by the key word:
Quote
  command line argument
and there are many many answers of your question.

such as:
http://forums.codeblocks.org/index.php/topic,13711.0.html
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline xunxun

  • Almost regular
  • **
  • Posts: 187
Re: running a compiled program with parameters?
« Reply #2 on: December 19, 2010, 04:15:10 am »
Project -- Set program's argument -- Select your target -- Program arguments
Regards,
xunxun

Offline ixfd64

  • Multiple posting newcomer
  • *
  • Posts: 26
    • Facebook
Re: running a compiled program with parameters?
« Reply #3 on: December 19, 2010, 06:46:16 am »
Thanks!