Discussion forums
[Visual Studio] [C++] [Fortran] Writing ouput C++/Fortran
You have to be logged in to reply
Author | Message |
---|---|
ExaSec56
Member |
Posted on 30/11/2021 at 14:33:44
Hello,I am building a project in C++/Fortran and I am using Visual Studio. However, I am facing an issue. When I try to print a value either in C++ or in Fortran, the value is printed on the console of Visual Studio but the console is quickly closed automatically after opening so I cannot see anything. For example, when I do this in C++: std::cout << "text to print" << std::endl; I cannot see the printed text since the console does not stay open. Is it possible to redirect all outputs from Visual Studio to somewhere else or a file instead of printed them on the console without changing the code? Thank you. |
TheLibrarian
**Moderator** |
Posted on 30/11/2021 at 19:05:05
Hello ExaSec! 🙂To redirect all standard outputs to a text file in Visual Studio without changing your code, you can modify the properties of your Visual Studio project. You can do the following:
For example, you can add > test.txt to redirect all standard outputs to a file named "test.txt" which will be created if it does not already exist or overwritten if it already exists. You can of course do the same for the standard errors. I hope it helps. -------------------------- |
ExaSec56
Member |
Posted on 30/11/2021 at 19:33:22
Yes, it works. It is good to know.You saved me a lot of time. Thank you! |
You have to be logged in to reply
Share this page on social media: