Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ iostreams and python

Is it possible to interoperate with a C++ iostream and python? I'm using boost-python and want to wrap a function that has istream and ostream as arguments.

like image 613
piotr Avatar asked Mar 04 '10 09:03

piotr


People also ask

Can you combine C with Python?

Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in object types, and they can call C library functions and system calls.

Is import in Python the same as include in C++?

#include in C and C++ is a textual include. import in Python is very different -- no textual inclusion at all! Rather, Python's import lets you access names exported by a self-contained, separately implemented module.

What is #include in Python?

Include() : A function that takes a full Python import path to another URLconf module that should be “included” in this place. Optionally, the application namespace and instance namespace where the entries will be included into can also be specified.

How do streams work CPP?

1.1 Streams C/C++ IO are based on streams, which are sequence of bytes flowing in and out of the programs (just like water and oil flowing through a pipe). In input operations, data bytes flow from an input source (such as keyboard, file, network or another program) into the program.


1 Answers

Is http://cci.lbl.gov/cctbx_sources/boost_adaptbx/python_streambuf.h what you are looking for? It comes from the Phenix project.

(license information at http://cci.lbl.gov/cctbx_sources/boost_adaptbx/LICENSE_2_0.txt)

like image 159
gurney alex Avatar answered Oct 12 '22 02:10

gurney alex