如何将C中的字符串缓冲区返回给Python? [英] How to return a string buffer in C to Python?

查看:195
本文介绍了如何将C中的字符串缓冲区返回给Python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个问题。如何将C中的字符串缓冲区返回给Python?例如,我在python中有一个cStringIO.StringIO,如何将它传递给C函数fun(char *),并依次返回它?



谢谢。

Hi everyone,

I have a question. How to return a string buffer in C to Python? For instance, I have a cStringIO.StringIO in python, how to pass it into C function fun(char*), and return it in turn?

thanks.

推荐答案

可能看一下管道:



-python-to-c-program [ ^ ]
Might have a look at pipes:

http://stackoverflow.com/questions/4961267/pass-many-pieces-of-data-from-python-to-c-program[^]


这篇关于如何将C中的字符串缓冲区返回给Python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆