Android NDK 和 __android_log_print

标签 android c android-ndk

我使用这个库:https://github.com/mysolution/hyphenator在 JNI 中,我创建了这个函数:

int main2()
{
 //load russian hyphenation patterns
 struct pattern_list_t* plist = create_pattern_list();
 size_t i = 0;
 while (patterns[i])
 {
 struct pattern_t* p = create_pattern(patterns[i], isdigit_func, ismarker_func, char2digit_func);
 add_patern(plist, p);
 ++i;
 }
 sort_pattern_list(plist);

 //hyphenate test words
 size_t word_index = 0;
 while (test_words[word_index])
 {
 struct word_hyphenation_t* wh = hyphenate_word(test_words[word_index], plist, marker);
 i = 0;
 while (test_words[word_index][i])
 {
   __android_log_print(ANDROID_LOG_INFO, "HelloNDK!", "%c", test_words[word_index][i]);
 ++i;
 }

 destroy_word_hyphenation(wh);

 ++word_index;
 }

 //cleanup
 destroy_pattern_list(plist);
 return 0;
}

在 Android NDK 中这项工作有效,但我进入了 LogCat:

02-21 16:15:18.989: INFO/HelloNDK!(403):

如何解决这个问题?我认为编码有问题,但我不知道如何解决。

最佳答案

您的预期输出是什么?如果该字符超出 ASCII 范围,您当然需要查看支持它的 logcat。假设您要输出 UTF-8,Terminator在 Linux 和 Mintty 上很好(结合 Cygwin/等)在 Windows 上。

关于Android NDK 和 __android_log_print,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9379365/

相关文章:

android - 从 jni 访问 ArrayList 的元素

android - glDiscardFrameBufferEXT 在 Android 中未定义,是否有等效项?

安卓多屏设计

c++ - 使用 32 位无符号整数乘以 64 位数字的算法

android - 使用ARMCC编译Android原生库

C在控制台输入代码后不显示代码

检查 argv 是否包含特定的文件扩展名

java - 如何返回 DataSnapshot 值作为方法的结果?

android - 在位图上绘图?

android - 从 RemoteViews 查看实例