Debian Codegraph @

opcodes/fiopen.xml

raw symbols SCIP
1
2 <refentry id="fiopen">
3 <indexterm id="IndexFiopen"><primary>fiopen</primary></indexterm>
4 <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>fiopen</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>fiopen</refname>
13 <refpurpose>
14 Opens a file in a specific mode.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 <emphasis>fiopen</emphasis> can be used to open a file in one of the specified modes.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>ihandle <command>fiopen</command> ifilename, imode</synopsis>
28 </refsect1>
29
30 <refsect1>
31 <title>Initialization</title>
32 <para>
33 <emphasis>ihandle</emphasis> -- a number which specifies this file.
34 </para>
35
36 <para>
37 <emphasis>ifilename</emphasis> -- the target file's name (in double-quotes).
38 </para>
39
40 <para>
41 <emphasis>imode</emphasis> -- choose the mode of opening the file. <emphasis>imode</emphasis> can be a value chosen among the following:
42 <itemizedlist>
43 <listitem>
44 <para>0 - open a text file for writing</para>
45 </listitem>
46
47 <listitem>
48 <para>1 - open a text file for reading</para>
49 </listitem>
50
51 <listitem>
52 <para>2 - open a binary file for writing</para>
53 </listitem>
54
55 <listitem>
56 <para>3 - open a binary file for reading</para>
57 </listitem>
58 </itemizedlist>
59 </para>
60 </refsect1>
61
62 <refsect1>
63 <title>Performance</title>
64 <para>
65 <emphasis>fiopen</emphasis> opens a file to be used by the <link linkend="fout"><citetitle>fout</citetitle></link> family of opcodes. It is safer to use it in the header section, external to any instruments. It returns a number, <emphasis>ihandle</emphasis>, which unequivocally refers to the opened file.
66 </para>
67 <para>
68 If <emphasis>fiopen</emphasis> is called on an already open file, it just returns the same handle again, and does not close the file.
69 </para>
70
71 <para>
72 Notice that <link linkend="fout"><citetitle>fout</citetitle></link> and <link linkend="foutk"><citetitle>foutk</citetitle></link> can use either a string containing a file pathname, or a handle-number generated by <emphasis>fiopen</emphasis>. Whereas, with <link linkend="fouti"><citetitle>fouti</citetitle></link> and <link linkend="foutir"><citetitle>foutir</citetitle></link>, the target file can be only specified by means of a handle-number.
73 </para>
74 </refsect1>
75
76 <refsect1>
77 <title>Examples</title>
78 <para>
79 Here is an example of the fiopen opcode. It uses the file <ulink
80 url="examples/fiopen.csd"><citetitle>fiopen.csd</citetitle></ulink>.
81 Note that the example must be run from a directory for which the
82 user has write access.
83 <example>
84 <title>Example of the fiopen opcode.</title>
85 <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
86 <xi:include href="examples-xml/fiopen.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
87 </example>
88 </para>
89 </refsect1>
90
91 <refsect1>
92 <title>See also</title>
93 <para><link linkend="SigioFileIO"><citetitle>File Input and Output</citetitle></link></para>
94 </refsect1>
95
96 <refsect1>
97 <title>Credits</title>
98 <para>
99 <simplelist>
100 <member>Author: &namegabriel;</member>
101 <member>Italy</member>
102 <member>1999</member>
103 </simplelist>
104 </para>
105
106 <para>New in Csound version 3.56</para>
107 </refsect1>
108 </refentry>