<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 * ...
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="scanf_conversion">
    <refnamediv>
        <refname>scanf_conversion</refname>
        <refpurpose>mscanf, msscanf, mfscanf conversion specifications</refpurpose>
    </refnamediv>
    <refsection>
        <title>Description</title>
        <para>
            Each conversion specification in the <varname>format</varname> parameter contains the following elements:
        </para>
        <itemizedlist>
            <listitem>
                <para>
                    the character <literal>%</literal> (percent sign);
                </para>
            </listitem>
            <listitem>
                <para>
                    the optional assignment suppression character <literal>*</literal> (asterisk);
                </para>
            </listitem>
            <listitem>
                <para>
                    an optional numeric maximum field width;
                </para>
            </listitem>
            <listitem>
                <para>
                    a conversion code.
                </para>
            </listitem>
        </itemizedlist>
        <para>
            The conversion specification has the following syntax:
        </para>
        <para>
            <literal>[*][width][size]convcode</literal>.
        </para>
        <para>
            The results from the conversion are placed in <varname>v_i</varname> arguments unless you specify assignment suppression with <literal>*</literal> (asterisk). Assignment suppression provides a way to describe an input field that is to be skipped. The input field is a string of nonwhite-space characters. It extends to the next inappropriate character or until the field width, if specified, is exhausted.
        </para>
        <para>
            The conversion code indicates how to interpret the input field.
            You should not specify the <varname>v_i</varname> parameter for a
            suppressed field. You can use the following conversion codes:
        </para>
        <variablelist>
            <varlistentry>
                <term>%</term>
                <listitem>
                    <para>
                        accepts a single <literal>%</literal> (percent sign) input at this point; no assignment is done.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>d, i</term>
                <listitem>
                    <para>accepts a decimal integer.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>u</term>
                <listitem>
                    <para>accepts an unsigned decimal integer.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>o</term>
                <listitem>
                    <para>accepts an octal integer.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>accepts a hexadecimal integer.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>e, f, g</term>
                <listitem>
                    <para>
                        accepts a floating-point number. The next field is converted accordingly and stored through the corresponding parameter, which should be a pointer to a float. The input format for floating-point numbers is a string of digits, with the following optional characteristics:
                    </para>
                    <itemizedlist>
                        <listitem>
                            <para>
                                it can be a signed value;
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                it can be an exponential value, containing a decimal point followed by an exponent field, which consists of an <literal>E</literal> or an <literal>e</literal> followed by an (optionally signed) integer;
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                it can be one of the special values <constant>%inf</constant>, <constant>%nan</constant>;
                            </para>
                        </listitem>
                    </itemizedlist>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>s</term>
                <listitem>
                    <para>accepts a string of characters.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>c</term>
                <listitem>
                    <para>
                        character value is expected. The normal skip over white-space is suppressed.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>%lg</term>
                <listitem>
                    <para>gets value as a double.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="msscanf">msscanf</link>
            </member>
            <member>
                <link linkend="mfscanf">mfscanf</link>
            </member>
            <member>
                <link linkend="mscanf">mscanf</link>
            </member>
            <member>
                <link linkend="printf_conversion">printf_conversion</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
