且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么重定向标准输出/标准错误在Android上不工作?

更新时间:2023-11-06 11:45:16

这样做是有一个文件的另一种方式 /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.