The Alternative Csound Reference Manual
Previous |  | Next

# fprintks

fprintks -- Similar to printks but prints to a file.

## Description

Similar to printks but prints to a file.

## Syntax

fprintks "filename", "string", [, kval1] [, kval2] [...]

## Initialization

"filename" -- name of the output file.

"string" -- the text string to be printed. Can be up to 8192 characters and must be in double quotes.

## Performance

kval1, kval2, ... (optional) -- The k-rate values to be printed. These are specified in "string" with the standard C value specifier (%f, %d, etc.) in the order given.

fprintks is similar to the printks opcode except it outputs to a file and doesn't have a itime parameter. For more information about output formatting, please look at printks's documentation.

## Examples

Here is an example of the fprintks opcode. It uses the files fprintks.orc and fprintks.sco.

Example 1. Example of the fprintks opcode.

    /* fprintks.orc */
    /* Written by Matt Ingalls, edited by Kevin Conder. */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1 - a score generator example.
    instr 1
      ; K-rate stuff.
      kstart init 0
      kdur linrand 10
      kpitch linrand 8

      ; Printing to to a file called "my.sco".
      fprintks "my.sco", "i1\\t%2.2f\\t%2.2f\\t%2.2f\\n", kstart, kdur, 4+kpitch

      knext linrand 1
      kstart = kstart + knext
    endin
    /* fprintks.orc */

    /* fprintks.sco */
    /* Written by Matt Ingalls, edited by Kevin Conder. */
    ; Play Instrument #1.
    i 1 0 0.001
    /* fprintks.sco */

This example will generate a file called "my.sco". It should contain lines like this:

    i1      0.00    3.94    10.26
    i1      0.20    3.35    6.22
    i1      0.67    3.65    11.33
    i1      1.31    1.42    4.13

## See Also

printks

## Credits

Author: Matt Ingalls
January 2003

Previous | Home | Next
foutk | Up | fprints