How can I get the cout output of the native c++ program on the log-cat in android application development in eclipse.
Please someone help me here.
How can I get the cout output of the native c++ program on the log-cat in android application development in eclipse.
Please someone help me here.
The stdout/stderr file descriptors are sent to /dev/null
in Android apps. (The Java equivalents, System.out
and System.err
, are redirected to the log by the app framework.)
The Dalvik VM includes a hack that will let you see stdout/stderr on a rooted device by setting the log.redirect-stdio
property. See this link for details. It works by starting a thread that reads from the stdio file descriptors and copies the data to the logging system.
For new code, it's much easier to use the Android log calls directly. If you're importing a library from elsewhere, of course, it's a bit harder. If necessary you could copy the code out of Dalvik and into your app and have it do the same thing.