JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xf5
2017-06-01 09:06
786 查看
原因是没有指定string的结束符’\0’,也就是代码中注释的那句话,加上就好了
extern "C" JNIEXPORT jstring JNICALL Java_com_komlin_gpio_gpiotest_Gpio_powerState(JNIEnv *env, jclass type) { FILE *pFile; char value[4]; pFile = fopen("/sys/class/gpio/gpio233/direction", "w+"); fwrite("in", sizeof(char), sizeof("in"), pFile); fclose(pFile); pFile = fopen("/sys/class/gpio/gpio233/value", "r+"); fread(value, sizeof(char), 1, pFile); fclose(pFile); //value[1] = '\0'; std::string returnValue = value; return env->NewStringUTF(returnValue.c_str()); }
相关文章推荐
- JNI WARNING: NewStringUTF input is not valid Modified UTF-8: illegal start byte 0xb0
- JNI WARNING: input is not valid Modified UTF-8: illegal start byte 0xfe
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0
- crash - JNI WARNING: input is not valid modified utf-8: illegal continuation byte
- input is not valid Modified UTF-8: illegal start byte 0x**
- jni 中使用NewStringUTF时报错:input is not valid Modified UTF-8: illegal start byte 0xa0(十六进制未定义字符)
- newStringUTF出现input is not valid Modified UTF-8错误解决办法
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x3f
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x12
- JNI WARNING: input is not valid Modified UTF-8
- 关于调用listFile()在遍历含有乱码文件时出现input is not valid Modified UTF-8错误的解决方法
- SOAP-ERROR: Encoding: string … is not a valid utf-8 string
- Leetcode:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
- 【opencl】buildprogram错误日志提示source file is not valid utf-8
- 遇到BAM报错“input is not proper UTF-8”的一个可能解决方案
- Android: Type Method 'NewStringUTF' could not be resolved
- Eclipse - Method NewStringUTF() could not be resolved
- 解决NDK开发中的 Method 'NewStringUTF' could not be resolved
- 错误提示:transform.position assign attempt for 'XXX' is notvalid。Input rotation is {NaN, NaN, NaN, NaN}
- The input character is not valid in MATLAB statements or expressions.