| 1 | |
| 2 | |
| 3 | <refentry id="readfi"> |
| 4 | <indexterm id="IndexReadfi"><primary>readfi</primary></indexterm> |
| 5 | <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo> |
| 6 | <refmeta> |
| 7 | <refentrytitle>readfi</refentrytitle> |
| 8 | </refmeta> |
| 9 | |
| 10 | <refnamediv> |
| 11 | <refname>readfi</refname> |
| 12 | <refpurpose> |
| 13 | Read a line of text from an external file. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para>Plugin opcode in cs_date.</para> |
| 20 | <para> |
| 21 | Read a line of text from an external file once on initialisation. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>Sres, iline <command>readfi</command> ifilname</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>ifilname</emphasis> -- an integer N denoting a file named "input.N" or a character string (in double quotes, spaces permitted) denoting the external file name. For a string, it may either be a full path name with directory specified or a simple filename. In the later case, the file is sought first in the current directory, then in SSDIR, and finally in SFDIR. |
| 34 | </para> |
| 35 | <para> |
| 36 | <emphasis>iline</emphasis> -- line number, or -1 when end of file has been reached. |
| 37 | </para> |
| 38 | <para> |
| 39 | <emphasis>Sres</emphasis> -- output of the line read from <emphasis>ifilname</emphasis>. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | This opcode allows a line of text to be read from a named |
| 44 | external file. There may be any number of |
| 45 | <emphasis>readfi</emphasis> opcodes in an instrument or orchestra |
| 46 | but they read separately from the same or different files. |
| 47 | </para> |
| 48 | </refsect1> |
| 49 | <refsect1> |
| 50 | <title>Examples</title> |
| 51 | <para> |
| 52 | Here is an example of the readfi opcode. It uses the file <ulink url="examples/readfi.csd"><citetitle>readfi.csd</citetitle></ulink>. |
| 53 | <example> |
| 54 | <title>Example of the readfi opcode.</title> |
| 55 | <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> |
| 56 | <xi:include href="examples-xml/readfi.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 57 | </example> |
| 58 | </para> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>See also</title> |
| 63 | <para><link linkend="SigioFileIO"><citetitle>File Input and Output</citetitle></link></para> |
| 64 | </refsect1> |
| 65 | |
| 66 | <refsect1> |
| 67 | <title>Credits</title> |
| 68 | <para>&namejohn; and Joachim Heintz</para> |
| 69 | <para>2012; new in 5.17.12</para> |
| 70 | </refsect1> |
| 71 | </refentry> |