summaryrefslogtreecommitdiff
path: root/opcodes/fiopen.xml
blob: d2d4f19d06e1fe20e47d65de8a8d548c718c26a3 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<refentry id="fiopen">
<indexterm id="IndexFiopen"><primary>fiopen</primary></indexterm>
  <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo>
  <refmeta>
    <refentrytitle>fiopen</refentrytitle>
  </refmeta>


 
  <refnamediv>
    <refname>fiopen</refname>
    <refpurpose>
      Opens a file in a specific mode.
          </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      <emphasis>fiopen</emphasis> can be used to open a file in one of the specified modes.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ihandle <command>fiopen</command> ifilename, imode</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ihandle</emphasis> -- a number which specifies this file.
    </para>

    <para>
      <emphasis>ifilename</emphasis> -- the output file's name (in double-quotes).
    </para>

    <para>
      <emphasis>imode</emphasis> -- choose the mode of opening the file. <emphasis>imode</emphasis> can be a value chosen among the following:
      <itemizedlist>
        <listitem>
          <para>0 - open a text file for writing</para>
        </listitem>

        <listitem>
          <para>1 - open a text file for reading</para>
        </listitem>

        <listitem>
          <para>2 - open a binary file for writing</para>
        </listitem>

        <listitem>
          <para>3 - open a binary file for reading</para>
        </listitem>
      </itemizedlist>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <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.
    </para>
    <para>
      If <emphasis>fiopen</emphasis> is called on an already open file, it just returns the same handle again, and does not close the file.
    </para>

    <para>
      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.
    </para>
  </refsect1>
 
  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="ficlose"><citetitle>ficlose</citetitle></link>
      <link linkend="fout"><citetitle>fout</citetitle></link>, 
      <link linkend="fouti"><citetitle>fouti</citetitle></link>, 
      <link linkend="foutir"><citetitle>foutir</citetitle></link>, 
      <link linkend="foutk"><citetitle>foutk</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namegabriel;</member>
        <member>Italy</member>
        <member>1999</member>
      </simplelist>
    </para>

    <para>New in Csound version 3.56</para>
  </refsect1>
</refentry>