⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printf.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>printf</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1764">&nbsp;</a>NAME</h4><blockquote>printf - write formatted output</blockquote><h4><a name = "tag_001_014_1765">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>printf <i>format</i><b>[</b><i>argument</i>...<b>]</b></code></pre></blockquote><h4><a name = "tag_001_014_1766">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>printf</i>utility will write formatted operands to the standard output.The<i>argument</i>operands will be formatted under control of the<i>format</i>operand.</blockquote><h4><a name = "tag_001_014_1767">&nbsp;</a>OPTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1768">&nbsp;</a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>format</i><dd>A string describing the format to use to write the remaining operands;see the EXTENDED DESCRIPTION section.<dt><i>argument</i><dd>The strings to be written to standard output, under the control of<i>format</i>;see the EXTENDED DESCRIPTION section.</dl></blockquote><h4><a name = "tag_001_014_1769">&nbsp;</a>STDIN</h4><blockquote>Not used.</blockquote><h4><a name = "tag_001_014_1770">&nbsp;</a>INPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1771">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>printf</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>LC_NUMERIC</i><dd>Determine thelocale for numeric formatting.It will affect the format of numbers written using thee,E,f,gandGconversion characters (if supported).<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_1772">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1773">&nbsp;</a>STDOUT</h4><blockquote>See the EXTENDED DESCRIPTION section.</blockquote><h4><a name = "tag_001_014_1774">&nbsp;</a>STDERR</h4><blockquote>Used only for diagnostic messages.</blockquote><h4><a name = "tag_001_014_1775">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1776">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>The<i>format</i>operand will be used as the<i>format</i>string described inthe <b>XBD</b> specification, <a href="../xbd/notation.html"><b>File Format Notation</b>&nbsp;</a> with the following exceptions:<ul><p><li>A <img src="../images/delta.gif" border=0> character in the format string, in any context otherthan a flag of a conversion specification, will be treated asan ordinary character that is copied to the output.<p><li>In addition to the escape sequences shown inthe <b>XBD</b> specification, <a href="../xbd/notation.html"><b>File Format Notation</b>&nbsp;</a> (\\,\a,\b,\f,\n,\r,\t,\v),<b>\</b><i>ddd</i>,where<i>ddd</i>is a one-, two- or three-digit octal number,will be written as a byte with the numeric value specified bythe octal number.<p><li>The implementation will not precede or follow output from thedoruconversion specifications withblank charactersnot specified by the<i>format</i>operand.<p><li>The implementation will not precede output from theoconversion specification with zeros not specified by the<i>format</i>operand.<p><li>Thee,E,f,gandGconversion specifications need not be supported.<p><li>An additional conversion character,b,will be supported as follows.The argument will be taken to be a string that maycontain backslash-escape sequences.The following backslash-escape sequences will be supported:<ul><p><li>the escape sequences listed inthe <b>XBD</b> specification, <a href="../xbd/notation.html"><b>File Format Notation</b>&nbsp;</a> (\\,\a,\b,\f,\n,\r,\t,\v),which will be converted to the characters they represent<p><li><b>\0</b><i>ddd</i>,where<i>ddd</i>is a zero-, one-, two- or three-digit octal numberthat will be converted to a byte with the numeric value specifiedby the octal number<p><li>\c,which will not be written and will cause<i>printf</i>to ignore any remaining characters in thestring operand containing it, any remainingstring operands and any additional characters in the<i>format</i>operand.<p></ul><p>The interpretation of a backslash followed by any other sequenceof characters is unspecified.<p>Bytes from the converted string will be written until the endof the string or the number of bytes indicated by the precisionspecification is reached.If the precision is omitted, itwill be taken to be infinite, so all bytes up to the end of the convertedstring will be written.<p><li>For each specification that consumes an argument, the next argumentoperand will be evaluated and converted to the appropriatetype for the conversion as specified below.<p><li>The<i>format</i>operand will be reused as often as necessary tosatisfy the argument operands.Any extracorsconversion specifications will be evaluated as if a null string argumentwere supplied; other extra conversion specifications will beevaluated as if a zero argument were supplied.If the<i>format</i>operand contains no conversion specifications and<i>argument</i>operands are present, the results are unspecified.<p><li>If a character sequence in the<i>format</i>operand begins with a"%"character, but does not form a valid conversion specification,the behaviour is unspecified.<p></ul><p>The<i>argument</i>operands will be treated as strings if the correspondingconversion character isb,cors;otherwise, it will be evaluated as aC constant, as described by the ISO&nbsp;C standard, with the following extensions:<ul><p><li>A leading plus or minus sign will be allowed.<p><p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -