Fix typos in help pages of module fileio (en_US, ru_RU)
[scilab.git] / scilab / modules / fileio / help / en_US / mput.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * ...
6  * 
7  * This file must be used under the terms of the CeCILL.
8  * This source file is licensed as described in the file COPYING, which
9  * you should have received as part of this distribution.  The terms
10  * are also available at    
11  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
12  *
13  -->
14 <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" version="5.0-subset Scilab" xml:lang="en" xml:id="mput">
15     <refnamediv>
16         <refname>mput</refname>
17         <refpurpose> writes  byte or word in a given binary format</refpurpose>
18     </refnamediv>
19     <refsynopsisdiv>
20         <title>Calling Sequence</title>
21         <synopsis>mput(x [, type, fd])</synopsis>
22     </refsynopsisdiv>
23     <refsection>
24         <title>Arguments</title>
25         <variablelist>
26             <varlistentry>
27                 <term>x</term>
28                 <listitem>
29                     <para>a vector of floating point or integer type numbers</para>
30                 </listitem>
31             </varlistentry>
32             <varlistentry>
33                 <term>fd</term>
34                 <listitem>
35                     <para>
36                         a scalar: a file descriptor returned by the function <function>mopen</function>. <literal>-1</literal> 
37                         stands for last opened file. Default value is 
38                         <literal>-1</literal>.
39                     </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>type</term>
44                 <listitem>
45                     <para>
46                         a string: the binary format used to write all the entries of <varname>x</varname>.
47                     </para>
48                 </listitem>
49             </varlistentry>
50         </variablelist>
51     </refsection>
52     <refsection>
53         <title>Description</title>
54         <para>
55             The <function>mput</function> function writes data to the output specified by the
56             stream parameter <varname>fd</varname>. Data is written at the
57             position at which the file pointer is currently pointing and 
58             advances the indicator appropriately. 
59         </para>
60         <para>
61             The <varname>type</varname> parameter is a conversion specifier which may be set to any of the
62             following flag characters (with default value <literal>"l"</literal>):
63         </para>
64         <variablelist>
65             <varlistentry>
66                 <term>"l", "i", "s", "ul", "ui", "us", "d", "f", "c", "uc"</term>
67                 <listitem>
68                     <para>
69                         for  writing respectively a long, an int, a short, an unsigned long, an unsigned int, an unsigned short, a double, a float, a char and an unsigned char. The bytes which are wrote are automatically swapped if necessary (by checking little-endian status) in order to produce machine independent binary files (in little-endian mode). This default swapping mode can be suppressed by adding a flag <code>swap = 0</code> in the <function>mopen</function> function.
70                     </para>
71                 </listitem>
72             </varlistentry>
73             <varlistentry>
74                 <term>"..l" or "..b"</term>
75                 <listitem>
76                     <para>
77                         It is also possible to write in little-endian or big-endian 
78                         mode  by adding a <literal>"l"</literal> or 
79                         <literal>"b"</literal> character at the end of a 
80                         <varname>type</varname> specification. For example 
81                         <literal>"db"</literal> will write a double in big-endian mode.
82                     </para>
83                 </listitem>
84             </varlistentry>
85         </variablelist>
86     </refsection>
87     <refsection>
88         <title>Examples</title>
89         <programlisting role="example"><![CDATA[ 
90 filen = 'test.bin';
91 mopen(filen,'wb');
92 mput(1996,'l');mput(1996,'i');mput(1996,'s');mput(98,'c');
93
94 // force little-endian 
95 mput(1996,'ll');mput(1996,'il');mput(1996,'sl');mput(98,'cl');
96
97 // force big-endian 
98 mput(1996,'lb');mput(1996,'ib');mput(1996,'sb');mput(98,'cb');
99
100 mclose();
101 mopen(filen,'rb');
102 if 1996<>mget(1,'l') then pause,end
103 if 1996<>mget(1,'i') then pause,end
104 if 1996<>mget(1,'s') then pause,end
105 if   98<>mget(1,'c') then pause,end
106
107 // force little-endian
108 if 1996<>mget(1,'ll') then pause,end
109 if 1996<>mget(1,'il') then pause,end
110 if 1996<>mget(1,'sl') then pause,end
111 if   98<>mget(1,'cl') then pause,end
112
113 // force big-endian 
114 if 1996<>mget(1,'lb') then pause,end
115 if 1996<>mget(1,'ib') then pause,end
116 if 1996<>mget(1,'sb') then pause,end
117 if   98<>mget(1,'cb') then pause,end
118
119 mclose();
120  ]]></programlisting>
121     </refsection>
122     <refsection role="see also">
123         <title>See Also</title>
124         <simplelist type="inline">
125             <member>
126                 <link linkend="mclose">mclose</link>
127             </member>
128             <member>
129                 <link linkend="meof">meof</link>
130             </member>
131             <member>
132                 <link linkend="mfprintf">mfprintf</link>
133             </member>
134             <member>
135                 <link linkend="fprintfMat">fprintfMat</link>
136             </member>
137             <member>
138                 <link linkend="mfscanf">mfscanf</link>
139             </member>
140             <member>
141                 <link linkend="fscanfMat">fscanfMat</link>
142             </member>
143             <member>
144                 <link linkend="mget">mget</link>
145             </member>
146             <member>
147                 <link linkend="mgetl">mgetl</link>
148             </member>
149             <member>
150                 <link linkend="mgetstr">mgetstr</link>
151             </member>
152             <member>
153                 <link linkend="mopen">mopen</link>
154             </member>
155             <member>
156                 <link linkend="mprintf">mprintf</link>
157             </member>
158             <member>
159                 <link linkend="mputl">mputl</link>
160             </member>
161             <member>
162                 <link linkend="mputstr">mputstr</link>
163             </member>
164             <member>
165                 <link linkend="mseek">mseek</link>
166             </member>
167             <member>
168                 <link linkend="mtell">mtell</link>
169             </member>
170             <member>
171                 <link linkend="mdelete">mdelete</link>
172             </member>
173         </simplelist>
174     </refsection>
175 </refentry>