readfi
Prev | Orchestra Opcodes and Operators | Next

## readfi

readfi — Read a line of text from an external file.

## Description

Read a line of text from an external file once on initialisation.

## Syntax

    Sres readfi ifilname

## Initialization

ifilname -- 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.

Sres -- output of the line read from ifilname.

This opcode allows a line of text to be read from a named external file. There may be any number of readfi opcodes in an instrument or orchestra but they read separately from the same or different files.

## Examples

Here is an example of the readfi opcode. It uses the file readfi.csd.

Example 705. Example of the readfi opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    -n
    </CsOptions>
    <CsInstruments>
    instr 1
        Swd pwd
            printf_i "Working directory is '%s'\n", 1, Swd
            prints "Reading myself =):\n"
    read:
    Sline, iLineNum readfi "readfi.csd"
            printf_i  "Line %d: %s", iLineNum, iLineNum, Sline
            if iLineNum < 17 igoto read
    endin
    </CsInstruments>
    <CsScore>
    i1 0 0.1
    e
    </CsScore>
    </CsoundSynthesizer>

## See Also

readf.

## Credits

John ffitch and Joachim Heintz

2012; new in 5.17.12

Prev | Up | Next
readf | Home | readk