terpri

Gamma: Version 4.0
Prev |  | Next

# `terpri`

`terpri` -- prints a newline to an open file.

## Syntax

    terpri (file?)

## Arguments

`file`

  A file pointer to a previously opened file. This may be either a file in the file system, or a string opened for read and write.

## Returns

t if successful, otherwise nil.

## Description

This function writes a newline to the open `file`. Any existing contents written to a file before it was opened will be deleted when the file is opened and written to.

## Example

This example writes a file with the following contents, including the newline:

              (chars (1 2 3))
              (chars (4 5 6))

        Gamma> fw = open("mytpfile.dat", "w");
        #<File:"mytpfile.dat">
        Gamma> write(fw,list(#chars,list(1,2,3)));
        t
        Gamma> terpri(fw);
        t
        Gamma> write(fw,list(#chars,list(4,5,6)));
        t
        Gamma> close(fw);
        t
        Gamma> fr = open("mytpfile.dat", "r", nil);
        #<File:"mytpfile.dat">
        Gamma> read_line(fr);
        "(chars (1 2 3))"
        Gamma> read_line(fr);
        "(chars (4 5 6))"
        Gamma> terpri();

        t
        Gamma>

Prev | Home | Next
`tell` | Up | `unread_char`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.