Nokia N97 SDK
Example Applications Guide

Redirect stdio to a file

1. About this Example
2. Prerequisites
3. Design and Implementation


1. About this Example

This example illustrates how to redirect stdio to a file. libc library provides freopen API to redirect all standard IOs (namely, stderr, stdin, or stdout). Application first printf launching information at console and then open one file to redirect stdout using freopen. Calling freopen once more, user can change the filename during execution. This helps lot to redirect application printf messages into a log file.


2. Prerequisites

This example requires a familiarity with POSIX standard C APIs, and access to Open C documentation.


3. Design and Implementation

3.1 Capabilities

The program capabilities are defined in redirectprintf.mmp file: CAPABILITY NONE.

3.2 Application Launching

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:

  1. Executing redirectprintf from eshell.
  2. Clicking default icon with display text redirectprintf within the install folder launcher application.

© Nokia 2009

Back to top