为什么重定向标准输出/标准错误在Android上不工作? [英] Why is redirecting stdout/stderr on android not working?

查看:286
本文介绍了为什么重定向标准输出/标准错误在Android上不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了SDL 1.3和OpenGL ES的在我的Andr​​oid 2.2的设备进行了测试在一起。它工作正常,但我不明白的输出的printf 通话。我想提到在 Android开发者页面下面的命令,但没有 DDMS 在Eclipse和亚行logcat 报道说,程序写入使用字符串的printf 。我就确定了标准输出标记筛选。

I downloaded SDL 1.3 and tested it together with OpenGL ES on my android 2.2 device. It works fine but I don't get the outputs from the printf calls. I tried the commands below as mentioned at the android developer page but neither DDMS in Eclipse nor adb logcat reports the strings that the program writes using printf. I made sure to filter for the stdout tag.

$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start

我在想什么或者做错了吗?

What am I missing or doing wrong?

推荐答案

这样做是有一个文件的另一种方式 /data/local.prop ,只包含行 log.redirect-标准输入输出=真。也许这工作得更好?另外请注意,标准输出缓冲,所以它可能是您的输出依旧坐在缓冲区,等待刷新。您可以拨打 fflush 手动进行检查。

Another way of doing this is having a file /data/local.prop, containing just the line log.redirect-stdio=true. Maybe this works better? Also, note that stdout is buffered, so it could be that your output is still sitting in the buffer, waiting to be flushed. You can call fflush manually to check this.

这篇关于为什么重定向标准输出/标准错误在Android上不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆