Symbian3/SDK/Source/GUID-6D59E35B-6572-519A-8CFD-CB7781DDE631.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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 xml:lang="en" id="GUID-6D59E35B-6572-519A-8CFD-CB7781DDE631"><title>printf</title><prolog><metadata><keywords/></metadata></prolog><conbody><p><userinput>printf format [ arg ... ] </userinput> </p> <p>Print the arguments according to the format specification. Formatting rules are the same as used in C. The same escape sequences as for <xref href="GUID-728F278B-30C8-5FA8-AD03-4C759690416E.dita">echo</xref> are recognised in the format. All C conversion specifications ending in one of <codeph>csdiouxXeEfgGn</codeph> are handled. </p> <table id="GUID-94F8F71A-02B3-52C8-BC40-19F1F30CB303"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>Option</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <codeph>%b</codeph>  </p> </entry> <entry><p>Cause escape sequences in the argument to be recognised. </p> </entry> </row> <row><entry><p> <codeph>%q </codeph>  </p> </entry> <entry><p>Quote the argument in such a way that allows it to be reused as shell input. With the numeric format specifiers, if the corresponding argument starts with a quote character, the numeric value of the following character is used as the number to print otherwise the argument is evaluated as an arithmetic expression. </p> </entry> </row> <row><entry><p> <codeph>%n</codeph>  </p> </entry> <entry><p>The corresponding argument is taken as an identifier which is created as an integer parameter. </p> </entry> </row> </tbody> </tgroup> </table> <p>Normally, conversion specifications are applied to each argument in order but they can explicitly specify the n<sup>th</sup> argument is to be used by replacing <codeph>%</codeph> by <codeph>%n$</codeph> and <codeph>*</codeph> by <codeph>*n$</codeph>. It is recommended that you do not mix references of this explicit style with the normal style and the handling of such mixed styles may be subject to future change. </p> <p>If arguments remain unused after formatting, the format string is reused until all arguments have been consumed. With the print builtin, this can be suppressed by using the <codeph>-r </codeph> option. If more arguments are required by the format than have been specified, the behaviour is as if zero or an empty string had been specified as the argument. </p> </conbody></concept>