I have a C++ program that writes some debug output to a file:
ofstream file;
ios_base::openmode mode = ios::out | ios::trunc | ios::binary;
file.open(path, mode);
file << "Very large debug output";
file.close();
This code gets executed from a python script by calling
subprocess.call(cmd, shell=True, executable="/bin/bash")
In a later step, the python script analyzes the debug output. Since the output is very large, writing it to disk and reading it again takes a lot of time, which is why I was wondering if there was a way to catch the call to open and write the data into a memory mapped file that would then be quickly accessible from python? Ideally with as little changes as possible to the C++ part of the code.