Redirect standard I/O to a file
This example illustrates how to redirect standard I/O to a file.
The libc
library provides freopen() API to redirect all standard IOs (namely - stderr, stdin or stdout).
Application first prints launching information at the console and
then opens one file to redirect standard output using freopen(). Calling freopen() once more, the user can change
the filename during execution. This helps to redirect application printf() messages into a log file.
Click on the following link to download the example: redirectprintf.zip
Click: browse to view the example code.
The following sections provide information about the implementation of the example.
Capabilities
The program capabilities are defined inredirectprintf.mmp
: CAPABILITY NONE
. The application is simple console based application. It has its own default icon and can be launched from the UI both in the emulator and in the device. The application can be launched by: Executing redirectprintf from eshell. Clicking default icon with display text redirectprintf within the install folder launcher application.