Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » system facilities » using sockets » close
next | previous | forward | backward | up | index | toc

close -- close a file

Description

f << close -- closes the file f.
close f -- closes the file f.

In the case of an output file, any buffered output is first written to the file, and the return value is an integer, normally 0, or -1 on error, or the return status of the child process in case the file was a pipe.

If the file was open for both input and output, both directions are closed.

If the file is a pipe to another process, i.e., the filename began with the character !, we will wait for the process to terminate. If you don't want to wait for the process to terminate, open the file with openInOut, and if necessary, use closeIn to close it, to indicate that it has received all its input.

If the file is stdio then it is left open, and no error is signaled.

Ways to use close:

  • Manipulator Database -- see Manipulator -- the class of all file manipulators
  • Manipulator File -- see Manipulator -- the class of all file manipulators
  • Manipulator Nothing -- see Manipulator -- the class of all file manipulators
  • new Manipulator from Function -- see Manipulator -- the class of all file manipulators
  • methods(Manipulator) -- see methods -- list methods
  • Manipulator NetFile -- see NetFile -- the class of all net files
  • NetFile << Manipulator -- see NetFile -- the class of all net files
  • File << Manipulator -- see printing to a file -- print to a file
  • Nothing << Manipulator -- see printing to a file -- print to a file

For the programmer

The object close is a manipulator.


The source of this document is in Macaulay2Doc/ov_system.m2:1483:0.