954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

debugging with C++ command line arguements

I'm having a small problem with debugging my application in VS C++.
When I pass in a single parameter, the debugger insists 2 parameters have been passed in.
The first parameter is invariably "d" and the second parameter is always the first character of whatever I pass in.

Further, if I run the program from the command line, I get the same problem except that the first parameter is always "s".

Does anyone have any idea what could be causing this? I suspect that maybe its a setting somewhere in VS, but it has me stumped.
Thanks

bussumarus
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

Do the parameters print ok when coded like this ? I am assuming you are NOT compiling for UNICODE because if you were you would be getting other problems.

#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    for(int i = 0; i < argc; i++)
        cout << argv[i] << "\n";
	return 0;
}
Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Ah, I was using a "char* argv[]" in my main function declaration.
Thanks!!

bussumarus
Newbie Poster
2 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You