Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » system facilities » using sockets » read » read(File)
next | previous | forward | backward | up | index | toc

# read(File) -- read from a file

- Function: read
- Usage:
    `read f`
- Inputs:
  - f, a file, an input file
- Outputs:
  - a string, a string obtained by reading from f.

## Description

    i1 : f = openInOut "!cat"

    o1 = !cat

    o1 : File

    i2 : isReady f

    o2 = false

    i3 : f << "hi there" << flush;

    i4 : isReady f

    o4 = false

    i5 : read f

    o5 = hi there

    i6 : isReady f

    o6 = false

## See also

- openIn -- open an input file
- get -- get the contents of a file
- isReady -- whether a file has data available for reading

## Ways to use this method:

- read(File) -- read from a file

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_system.m2:301:0.