Forums de discussion
[Visual Studio] [C++] [Fortran] Writing ouput C++/Fortran
Vous devez être connecté pour répondre
Auteur | Message |
---|---|
ExaSec56
Membre |
Posté le 30/11/2021 à 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
**Modérateur** |
Posté le 30/11/2021 à 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
Membre |
Posté le 30/11/2021 à 19:33:22
Yes, it works. It is good to know.You saved me a lot of time. Thank you! |
Vous devez être connecté pour répondre
Partager cette page sur les réseaux sociaux :