Issue
I have this two codes
Java:
public native void savex(int x);
C:
void Java_com_example_javatest_MainActivity_savex(jint x)
{
FILE *fp;
fp = fopen("/data/data/com.example.javatest/data.txt", "w");
fprintf(fp, "%d\n", (int)x);
fclose(fp);
}
When run the result is always having -1265282592 in data.txt. What's the problem here?
Solution
void Java_com_example_javatest_MainActivity_savex(jint x)
The function arguments must be:
void Java_com_example_javatest_MainActivity_savex(JNIEnv* env, jobject obj,jint x)
Answered By - JCWasmx86
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.