How to stop gmsh from printing into command window
Hello,
I'm using gmsh 4.8.0 (also tried 4.10.5) command line on windows 10.
I would like to know if there's a way to stop prevent gmsh from printing into the command window. I'm using c++. I tried to open gmsh.exe using both system() and popen() (and a .bat file) and it seems no matter what I do it always prints on the command window (I tried redirecting output using this but to no avail).
I've tried looking at the documentation but I have found no command line option to prevent printing.
#include <iostream>
#include <array>
int main()
{
std::array<char, 128> buffer;
std::string cmd = "gmsh t1.geo -2";
// system(cmd.c_str());
FILE* pipe = popen(cmd.c_str(), "r");
if (!pipe)
{
std::cerr << "Couldn't start gmsh." << std::endl;
}
while (fgets(buffer.data(), 128, pipe) != NULL) {
//std::cout << buffer.data(); // this instruction should give me the option to either print gmsh output or ignore it but gmsh prints either way
}
pclose(pipe);
system("pause");
return 0;
}
The reason I want to silence it is because I use gmsh in a multi-threaded topological optimization program where speed is important (printing makes it slow). Since it is multithreaded, all threads printing simultaneously makes the output unreadable anyway.
Thanks in advance.