Running a python program from a C++ program? -


i've been messing around selenium in python, , want have existing c++ program run python code.

basically, python code finds website, , downloads file afterwards c++ program wants open file , bunch of operations on it. if had mypythoncode.py file, , other c++ files (header.h, main.cpp, otherfunctions.cpp...) how go running python code c++ program?

also both of programs console programs, , hoping user have uninterrupted experience running program (for example, if user wants download file while running c++ program terminal doesn't have close, or open different window start python program). in going appreciated!

it operating system specific, , c++11 standard not define functions (except system(3), in c99, , std::system in c++11). on linux (and other posix systems), read advanced linux programming , consider using system, or popen(3), or more lower-level syscalls(2) fork(2), execve(2), pipe(2), dup2(2), etc etc.... may want ipc , may need have event loop around multiplexing syscall poll(2)

you use c++ frameworks qt or poco (both have process abstraction , usable on several operating systems, on proprietary ones microsoft)

if want c++ program have terminal interface on linux, consider ncurses and/or readline

btw, several c or c++ libraries http exist, e.g. libcurl http client side, , libonion http server side. might avoid python program , incorporate downloading in c++ application.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -