python open之后的bytes,加长度,
c++ 接收string,需要时pBuffer.c_str(),和长度就ok了。
c++别用char*,在linux下有时会报错。
代码:
c++
using namespace std;
int add_person(string cardID,string name,string pBuffer)
memset(stuInParam.pBuffer, 0, stuInParam.nBufferLen);
memcpy(stuInParam.pBuffer, pBuffer.c_str(), stuInParam.nBufferLen);
python:
with open('7308448f4877dedbc831510dd197fae.jpg', 'rb') as f:
content = f.read()
print(len(content))
# s2 = str(content,'utf-8')
# print(type(content))
dahua_sdk.add_person(cardID, name, content, len(content))