<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="fiopen">
  <refmeta>
    <refentrytitle>fiopen</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>fiopen</refname>
    <refpurpose>
      Opens a file in a specific mode.
      <indexterm id="IndexFiopen"><primary>fiopen</primary></indexterm>
    </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 must be defined in the header section, external to any instruments. It returns a number, <emphasis>ihandle</emphasis>, which unequivocally refers to the opened 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="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>
