Symbian3/SDK/Source/GUID-063020E5-51C0-45C3-8B8B-015385FA0928.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Wed, 31 Mar 2010 11:11:55 +0100
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
permissions -rw-r--r--
Week 12 contribution of API Specs and fix SDK submission

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-063020E5-51C0-45C3-8B8B-015385FA0928" xml:lang="en"><title>Redirect
Printf Example</title><shortdesc>Redirect standard I/O to a file</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>This example illustrates how to redirect standard I/O to a file. The <codeph>libc</codeph> library
provides <xref href="GUID-6A17B64B-44DC-33F0-B18A-25004500C831.dita"><apiname>freopen()</apiname></xref> 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 <xref href="GUID-6A17B64B-44DC-33F0-B18A-25004500C831.dita"><apiname>freopen()</apiname></xref>.
Calling <xref href="GUID-6A17B64B-44DC-33F0-B18A-25004500C831.dita"><apiname>freopen()</apiname></xref> once more, the user can change the filename
during execution. This helps to redirect application <xref href="GUID-919E1C29-029A-38E2-B844-141A6E02ADA2.dita"><apiname>printf()</apiname></xref> messages
into a log file. </p>
<section id="GUID-026FD8D6-6C4A-5958-B289-775D4AE1E756-GENID-1-8-1-11-1-1-5-1-3-1-11-1-16-1-3-2"><title>Download</title> <p>Click
on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-b83a4952-b5e5-4ef5-a1c9-ee48705964a1.zip" scope="external">redirectprintf.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-b83a4952-b5e5-4ef5-a1c9-ee48705964a1.html" scope="peer">browse</xref> to view the example code. </p> </section>
<section id="GUID-7E7C4564-B10E-41F9-8A9D-D8A6C5E9C51C-GENID-1-8-1-11-1-1-5-1-3-1-11-1-16-1-3-3"><title>Design and
Implementation</title> <p>The following sections provide information about
the implementation of the example. </p> <p><b>Capabilities</b> </p>The program
capabilities are defined in <filepath>redirectprintf.mmp</filepath> : <codeph>CAPABILITY
NONE</codeph>. </section>
<section id="GUID-67A72761-1D92-46D1-B1C9-7455978BDE4E-GENID-1-8-1-11-1-1-5-1-3-1-11-1-16-1-3-4"><title>Building and
Using</title> To build the example application, go to the redirectprintf\group
directory and build the application.  The definition for the whole application
can be found in the bld.inf file in the group subdirectory of the applications
main directory.<p>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. </p> </section>
</conbody></concept>