Skip to content

How to write a text file

Use $::io::nwrite with the data on the left and the file path on the right:

      #import $::io::nwrite
      'Hello, world!' nwrite '/path/to/output.txt'

The left argument is a character vector to write. The right argument is the file path.

You can also use the fully qualified name:

      'Hello, world!' $::io::nwrite '/path/to/output.txt'

Write computed results

Format a numeric array with before writing:

      ( 1 2 3 4 5) nwrite '/path/to/numbers.txt'

See also: Read a text file, Standard library -- I/O