JNI: passing bytes from c++ to java

后端 未结 1 1422
Happy的楠姐
Happy的楠姐 2021-02-14 00:55
HANDLE hFile = CreateFileA(\"C:\\\\myfile.zip\", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
const int size = GetFileSize(hFile, NULL);
char* buf         


        
1条回答
  •  情书的邮戳
    2021-02-14 01:25

    I think your missing a line like :

    (*env)-> SetByteArrayRegion(env, result, 0, size, fill);
    

    check out :

    http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jnistring.html

    for more details

    also a similar question was answered here

    How to return an array from JNI to Java?

    0 讨论(0)
提交回复
热议问题