How to get return value of c++ int main() output using subprocess.check_output() in python script

Advertisements Hi I am using a C++ script as follows EX: int main(){ int x =7; std::cout<<"print num:"<<x<<std::endl; if(x>0){ std::cout<<" good"<<std::endl; return 5; } return 0; } For this in my python file I am calling the subprocess as follows: result0_1 = subprocess.check_output(MYCPP_fILE_PATH,shell =True) print(result0_1.decode("utf-8")) It prints out "print num:" and "good" but dosn’t provide… Read More How to get return value of c++ int main() output using subprocess.check_output() in python script

Why does printf output characters instead of data?

Advertisements Why does printf output characters instead of data? Looking at the code, you can relatively understand what I want to do, but it is unclear why the output is like this #include <vector> #include <string> #include <cstdio> class Person { public: Person(const std::string& name, uint16_t old) : m_Name(name) , m_Old(old) { } public: std::string… Read More Why does printf output characters instead of data?