Author Topic: How to add custom command line arguments?  (Read 29730 times)

Offline fuzzymonkey

  • Multiple posting newcomer
  • *
  • Posts: 11
How to add custom command line arguments?
« on: November 17, 2010, 04:55:04 pm »
I have a project that reads in a file supplied by command line arguments. for testing purposes, it is the first argument (argv[1]). I tried to add the name of the file by going Projects->set programs' arguments-> and just typing in the name of the file under Programs arguments (for both the release version and the debug). However, my program always terminates after checking for the existence of the file passed from command line, meaning it was never passed in. If I execute my program from command line and manually add the file name, it works fine, it just does not work when I do it in codeblocks.

Any ideas?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: How to add custom command line arguments?
« Reply #1 on: November 17, 2010, 05:16:43 pm »
Have you tried "Project -> Set program's arguments" ?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline fuzzymonkey

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: How to add custom command line arguments?
« Reply #2 on: November 17, 2010, 05:30:59 pm »
Sorry to be an ass, but..... Did you even read my post? Specifically the second sentence when I said exactly that....

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: How to add custom command line arguments?
« Reply #3 on: November 17, 2010, 05:47:42 pm »
OK, Sorry, I've not read it fully...

This feature works, so you have to debug it yourself, using the debugger...
Put a breakpoint in the beginning of main and step from there...

Probably the working directory is not the one you're expecting.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]