Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: fuzzymonkey on November 17, 2010, 04:55:04 pm

Title: How to add custom command line arguments?
Post by: fuzzymonkey 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?
Title: Re: How to add custom command line arguments?
Post by: oBFusCATed on November 17, 2010, 05:16:43 pm
Have you tried "Project -> Set program's arguments" ?
Title: Re: How to add custom command line arguments?
Post by: fuzzymonkey 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....
Title: Re: How to add custom command line arguments?
Post by: oBFusCATed 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.