This group of functions operates on low-level file
descriptors, which use integers for file handles. In these
functions, the argument is a low-level-file
descriptor. These functions are part of module
fos.
Use these functions only when you really need
low-level I/O. Most applications will use a “file
object” as produced by the built-in
open() function; see
file objects
above.
close(f)Close file .f
dup(f)Returns a new file descriptor that is a duplicate
of .f
fstat(f)Return the file's status tuple in the same
format as os.stat().
lseek(f,p,w)Change the current position of
.
The f
and p
arguments are interpreted as in the
f.seek() method for file
objects.
open(p,f,m)Open the file at pathname . The value
p
describes various options, such as read or write
access, and whether to create the file if it doesn't
exist; see f/usr/include/fcntl.h
for C-language definitions for the
value. If you are creating the file, you can
supply f to specify the initial
permissions of the file as in
mchmod(). Returns a low-level
file descriptor.
pipe()Create a pipe. Returns a tuple
(
of two file descriptors,
fr,fw)
for reading and fr for
writing.fw
read(f,n)Read no more than bytes. Returns the
data as a string.n
write(f,s)Write string .s