|
|
1.1 root 1: .TH READ 2
2: .CT 2 file_io comm_proc
3: .SH NAME
4: read, write \(mi read or write file
5: .SH SYNOPSIS
6: .nf
7: .B int read(fildes, buffer, nbytes)
8: .B char *buffer;
9: .PP
10: .B int write(fildes, buffer, nbytes)
11: .B char *buffer;
12: .fi
13: .SH DESCRIPTION
14: .I Read
15: reads
16: .I nbytes
17: bytes of data
18: from the file pointer location in the file associated with
19: .I fildes
20: into memory at
21: .IR buffer .
22: The file pointer is advanced by the number of bytes read.
23: It is not guaranteed
24: that all
25: .I nbytes
26: bytes will be read; for example
27: if the file refers to a terminal at most one line
28: will be returned.
29: In any event the number of characters read is returned.
30: A return value of
31: 0 is conventionally interpreted as end of file.
32: .PP
33: .I Write
34: writes
35: .I nbytes
36: bytes of data starting at
37: .I buffer
38: to the file associated with
39: .I fildes
40: at the file pointer location.
41: The file pointer is advanced by the number of bytes written.
42: The number of characters actually written is returned.
43: It should be regarded as an error
44: if this is not the same as requested.
45: .PP
46: Reads and writes which are aligned with file system blocks
47: are more efficient than others; see
48: .IR filsys (5).
49: .SH "SEE ALSO"
50: .IR open (2),
51: .IR dup (2),
52: .IR pipe (2),
53: .IR select (2),
54: .IR dirread (2)
55: .SH DIAGNOSTICS
56: .IR read :
57: .BR EBADF ,
58: .BR EFAULT ,
59: .BR EINTR ,
60: .BR EINVAL ,
61: .BR ENXIO
62: .br
63: .IR write :
64: .BR EBADF ,
65: .BR EFAULT ,
66: .BR EINTR ,
67: .BR EINVAL ,
68: .BR EIO ,
69: .BR ENXIO ,
70: .BR EPIPE ,
71: .BR EROFS
72: .SH BUGS
73: A
74: .I read
75: or a
76: .I write
77: call may fail because of a prior call to
78: .IR lseek (2).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.