python - Python3 - read from unflushed buffer from other exe -
i have application written in c++ write ofstream (file output stream). problem is, c++-application writing 2'000 lines before flushing stream (<< endl) , output became visible inside file (which monitor via tail -f). debugging purpose want see unflushed content of stream.
adding << endl inside c++-application sounds logic, isn't possible @ because there many places have add << endl , going ugly because have add
#ifdef _debug filestream << endl; #endif
everywhere in code.
so i'm looking way read stream application. have read many stackoverflow articles, including [reading flushed vs unflushed buffers](reading flushed vs unflushed buffers) , many others. can find answers second application called subprocess inside python-script via
import subprocess p = subprocess.popen("a.out", **stdout=subprocess.pipe**)
and redirect stdout pipe. in case wont redirect stdout pipe subprocess, want read unflushed buffer. there way python 3?
Comments
Post a Comment