Context:
A C++ program is at the heart of a python routine. This program seems to fail at some point but I am unable to pinpoint the error since nothing is written to my log files.
It lead me to realise that, while std::cout and std::cerr would respectively write to the stdout and stderr sterams, other errors (e.g., Floating point exception) are not written to any of these streams (please correct me if I am wrong).
Minimal working example:
Consider test.cpp
#include <iostream>
using namespace std;
int main() { cout << "cout" << endl; cerr << "cerr" << endl; cout << 1/0 << endl; }
and compile it using g++ test.cpp -o test.
Executing the script with
./test 1> stdout 2> stderr
writes "cout" to stdout, "cerr" to stderr, as expected, but writes "Floating point exception" directly into my terminal window.
Is there a way to write this error in a file?