Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,
I am using visual studio to run following function
<br />
int main(int argc, char *argv[])<br />
{<br />
bla bla<br />
}<br />

I need to debug this code. the problem is I cant debug this code as i need to pass different parameters. More I cannot do out of argv as the program does not load the file if I give the path as a variable inside code.
Hope you are understanding
Thank you for help
Posted

You can pass the command line arguments from the IDE as follows,

Goto Project->Properties.
1. Expand configure properties section.
2. Goto Debug section.
3. Give the command line arguments in "Command Arguments" edit box.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Jul-11 16:13pm    
Best way, my 5, but I uses a different debugging method to accelerate debugging; please see my solution.
--SA
Espen Harlinn 18-Jul-11 18:31pm    
Right, a 5
Albert Holguin 18-Jul-11 20:51pm    
my 5
In addition to a correct method venkatmakam advised, I can offer the accelerated debugging technique based on simulation of command line.

Rename main to, say, debugmain(int, char*). Write new main which takes command line parameters from console, UI control or file and pass them to debugmain. It will take some time to implement but can accelerate your debugging a bit.

—SA
 
Share this answer
 
Comments
Espen Harlinn 18-Jul-11 18:33pm    
Also useful for console programs missing an option, my 5
Sergey Alexandrovich Kryukov 18-Jul-11 18:44pm    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900