Dear Gurus,

I want to embed python interpreter in my program. What I want is to redirect 
those output to a control such as RICHEDIT which can be modified as a output 
window in my program. So I can write *.py files outside of program and invoke 
it inside program as a script file. In order to get information output by the 
*.py file I need to get the stdin&stdout. I have tried some workflow but not 
perfect.

1). I have tried use Allocconsle(). But I can only get the output info printed 
by std::out & printf() in the current code. all things which are printed by 
python35.dll are missing. I used print('xxxx') in the *.py file to test the 
output. Those *.py files are OK in command line mode.

2). I also tried to derive class basic_streambuf and overwrite the in/out 
functions. It works only for output from std::out. Text from printf() as well 
as from dlls are missing.

3). then I tried to use linker settings as below.

#pragma comment( linker, "/subsystem:console /entry:wWinMainCRTStartup" )

A cmd window is created along with the program. everything output from current 
process and dlls are retrieved successfully as I want. But the cmd window is 
not easy to control.

Is there a better way for this purpose? 

Thanks in advance for your kind help.

Best Regards,

John.
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to