Command line arguments in Visual Studio.

I use argc and argv to get the name of the files but i dont know how to use the command line to pass it into the program. How do i get the command line to pop up? and what to i have to type in the command line if i want the first argv to be inFile and the second to be outFile?

Using a console, navigate to the directory where your executable is, and run

program.exe input.txt output.txt

argc will equal 3, argv[1] will equal "input.txt" and argv[2] will equal "output.txt".
Last edited on
If you run your project inside VS you can set the parameters under
Properties->Debugging->Command Arguments
Topic archived. No new replies allowed.