简体   繁体   中英

passing byte array from c++ to python

As the title suggests, I'd like to pass a byte array from c++ to python. I understand I would need to convert my byte array into a PyObject somehow but this is where I got stuck. Is there anyone who can help me out with this.

Thanks in advance,

PyBytes_FromString to the rescue assuming Python3+:

https://docs.python.org/3/c-api/bytes.html

Under Python2.x PyString_FromString :

https://docs.python.org/2/c-api/string.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM