tmighty
tmighty

Reputation: 11425

C++ VS2010 not using my Debug command line args

In VS2010 I set command line arguments in the project settings->Debugging->Command line arguments:

-d 48000 1 -raw test1.opus test1_decoded.raw

However, when I debug the project and have a look at the argv[] in

int main(int argc, char *argv[])
{

}

... I can see that these command line arguments are missing. The command line argument argv instead has only the path to the exe that is just being debugged. I see that if I move the mouse over the argv.

Does anybody have an idea what I might have done wrong?

Thank you for the help.

Upvotes: 1

Views: 420

Answers (1)

Ed Swangren
Ed Swangren

Reputation: 124800

However, when I debug the project and have a look at the argv[]...

Per your description and code, I'm assuming that you are hovering your mouse over argv or looking at it in the watch window. argv is a pointer to pointer to char. The debugger does not know how many elements it contains. It will show you the first element i.e.,*argv`), but no more because there is simply no safe, standard way of doing so.

Your command line arguments are there, but the debugger cannot figure out how many elements to display in the UI. Look at the value of argc; that should match your number of arguments +1 for the path to your executable.

Upvotes: 1

Related Questions