Reading input from file in Visual Studio 2008


Is there a way to simulate: yourprogram < inputFile.txt in Visual Studio 2008?

Best Solution

When you've developed your application (e.g. a ConsoleApplication) you would normally start this from the Command Line with

ConsoleApplication1.exe < inputfile.txt

The part of the command < inputfile.txt is the command line arguments to your application.

You can set these in your project properties

  • Right click the project file
  • Click properties
  • Click the Debug tab
  • In the Start Options section enter

    < Path/To/inputfile.txt

When you next launch your application with the debugger, it will execute your application with these Command line args