read.2

来自「unix v7是最后一个广泛发布的研究型UNIX版本」· 2 代码 · 共 52 行

2
52
字号
.TH READ 2 .SH NAMEread \- read from file.SH SYNOPSIS.B read(fildes, buffer, nbytes).br.B char *buffer;.SH DESCRIPTIONA file descriptor is a wordreturned from a successful.I "open, creat, dup,"or.I pipecall..I Bufferis the location of.I nbytescontiguousbytes into which the input will be placed.It is not guaranteedthat all.I nbytesbytes will be read; for exampleif the file refers to a typewriter at most one linewill be returned.In any event the number of characters read is returned..PPIf the returned value is 0, thenend-of-file has been reached..SH "SEE ALSO"open(2), creat(2), dup(2), pipe(2).SH DIAGNOSTICSAs mentioned,0 is returned when the end of the file has been reached.If the read was otherwise unsuccessfulthe return value is \-1.Many conditionscan generate an error:physical I/O errors, bad buffer address,preposterous.I nbytes,file descriptor not that ofan input file..SH ASSEMBLER(read = 3.).br(file descriptor in r0).br.B sys read; buffer; nbytes.br(byte count in r0)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?