1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<html lang="en">
<head>
<title>Numeric Input Conversions - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C_002dStyle-I_002fO-Functions.html#C_002dStyle-I_002fO-Functions" title="C-Style I/O Functions">
<link rel="prev" href="Table-of-Input-Conversions.html#Table-of-Input-Conversions" title="Table of Input Conversions">
<link rel="next" href="String-Input-Conversions.html#String-Input-Conversions" title="String Input Conversions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Numeric-Input-Conversions"></a>
Next: <a rel="next" accesskey="n" href="String-Input-Conversions.html#String-Input-Conversions">String Input Conversions</a>,
Previous: <a rel="previous" accesskey="p" href="Table-of-Input-Conversions.html#Table-of-Input-Conversions">Table of Input Conversions</a>,
Up: <a rel="up" accesskey="u" href="C_002dStyle-I_002fO-Functions.html#C_002dStyle-I_002fO-Functions">C-Style I/O Functions</a>
<hr>
</div>
<h4 class="subsection">14.2.14 Numeric Input Conversions</h4>
<p>This section describes the <code>scanf</code> conversions for reading numeric
values.
<p>The ‘<samp><span class="samp">%d</span></samp>’ conversion matches an optionally signed integer in decimal
radix.
<p>The ‘<samp><span class="samp">%i</span></samp>’ conversion matches an optionally signed integer in any of
the formats that the C language defines for specifying an integer
constant.
<p>For example, any of the strings ‘<samp><span class="samp">10</span></samp>’, ‘<samp><span class="samp">0xa</span></samp>’, or ‘<samp><span class="samp">012</span></samp>’
could be read in as integers under the ‘<samp><span class="samp">%i</span></samp>’ conversion. Each of
these specifies a number with decimal value <code>10</code>.
<p>The ‘<samp><span class="samp">%o</span></samp>’, ‘<samp><span class="samp">%u</span></samp>’, and ‘<samp><span class="samp">%x</span></samp>’ conversions match unsigned
integers in octal, decimal, and hexadecimal radices, respectively.
<p>The ‘<samp><span class="samp">%X</span></samp>’ conversion is identical to the ‘<samp><span class="samp">%x</span></samp>’ conversion. They
both permit either uppercase or lowercase letters to be used as digits.
<p>Unlike the C language <code>scanf</code>, Octave ignores the ‘<samp><span class="samp">h</span></samp>’,
‘<samp><span class="samp">l</span></samp>’, and ‘<samp><span class="samp">L</span></samp>’ modifiers.
</body></html>
|