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