close

Gamma: Version 4.0
Prev |  | Next

# `close`

`close` -- closes an open file.

## Syntax

    close (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 the `file` had been open and was closed successfully, else nil.

## Description

This function closes a previously opened file. It is not strictly necessary, as the file will be closed when the garbage collector recognizes that there are no references to the file, but it is extremely good policy. This function will close a string opened for reading and writing as well.

## Example

        Gamma> fp = open("myfile.dat","r");
        #<File:"myfile.dat">
        Gamma> close(fp);
        t
        Gamma> fp;
        #<Destroyed Instance>
        Gamma>

See the Common: The Text Message Display section of the Controller Functions chapter, or the GTK: Preparing Plots section of the Log Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

## See Also

`fd_close`, `open`, `open_string`

Prev | Home | Next
Input/Output | Up | `fd_close`

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