none
Visual Studio Community 2017 C++Start Without Debugging Not Working with Command Arguments

    Question

  • I am running Visual Studio Community 2017 version 15.9.3

    I made a new empty Console Project by clicking File->New->Project->Windows Desktop Wizard

    and then choosing "Console Application" and "Empty Project".

    I wrote a simple program

    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	char a;
    	cin >> a;
    	cout << a;
    }

    and pressed Ctrl+F5.

    I inputed 'e' and this is the output:

    e
    C:\Peter\_CPP\hello\Debug\hello.exe (process 4808) exited with code 0.
    Press any key to close this window . . .

    I pressed a key and the program exited.

    Then I made a file called "h.txt" and went to Project->Properties->Configuration Properties->Debugging->Command Arguments

    and used "<h.txt" for Command Arguments.

    This time, when I pressed Ctrl+F5, a console appeared and immediately closed.

    How can I solve this problem?

    Thanks



    • Edited by Yeeter Thursday, December 6, 2018 2:22 PM
    Thursday, December 6, 2018 2:21 PM