Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading input from file in Visual Studio 2008

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

like image 426
Epsilon Vector Avatar asked May 09 '09 13:05

Epsilon Vector


People also ask

How do you use custom input in VS code?

Go to settings (ctrl+,) -> Search settings -> : Code-runner : Run in terminal - Check this and you will be able to run the code directly in the terminal which takes input. :) Show activity on this post.

How do I get output in Visual Studio?

The Output window displays status messages for various features in the integrated development environment (IDE). To open the Output window, on the menu bar, choose View > Output, or press Ctrl+Alt+O.

How do I add a text file to Visual Studio C++?

Answers. In the 'Solution Explorer' right click your 'project' (NOT the 'Solution' node at the top) and select Add > New Item. In the 'Add New Item' dialog, select "Text File" and give it a name (file.


1 Answers

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

like image 84
Eoin Campbell Avatar answered Oct 21 '22 22:10

Eoin Campbell