flush

Gamma: Version 4.0
Prev |  | Next

# `flush`

`flush` -- flushes any pending output on a file or string.

## Syntax

    flush (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

## Description

This function flushes any pending output on the file or string. This has the effect of printing output on the screen or updating a file on disk in the case of a file. `flush` has no effect on strings. `flush` is called automatically by `close`.

## Example

        Gamma> fp=open("myflushfile.dat","w",nil);
        #<File:"myflushfile.dat">
        Gamma> write(fp, "I am written.");
        t
        Gamma> fp=open("myflushfile.dat","r",nil);
        #<File:"myflushfile.dat">
        Gamma> read_line(fp);
        "Unexpected end of file"

        Gamma> fp=open("myflushfile.dat","w",nil);
        #<File:"myflushfile.dat">
        Gamma> write(fp, "I am written.");
        t
        Gamma> flush(fp);
        t
        Gamma> fp=open("myflushfile.dat","r",nil);
        #<File:"myflushfile.dat">
        Gamma> read_line(fp);
        "\"I am written.\""
        Gamma>

## See Also

`open`, `open_string`

Prev | Home | Next
`file_size` | Up | `getcwd`

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