Getting the command line...

Started by
2 comments, last by ThoughtCriminal 18 years, 8 months ago
I'm writing a console app that has need of the command line. I'm also using VS, so if anyone knows how to add a command line parameter to and app under VS, I would be most grateful to know how. Thank you.
Advertisement
The command line arguments to a C/C++ program are passed via the argv parameter to main.

int main(int argc, char ** argv);

argc stores the number of arguments passed to main (including argv[0]) and argv is dereferenced to get the actual arguments.
Or, if you want to know how to pass parameters as opposed to read them, right click your project and choose properties, from there goto debugging and enter your parameters into the 'command arguments' box.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
Thank you, both of my questions have been answered

This topic is closed to new replies.

Advertisement