Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ (2) — Plan9 1st Edition

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(2)

open(2)

dup(2)

pipe(2)

READ(2)

NAME

read, write − read or write file

SYNOPSIS

long read(int fd, void ∗buf, long nbytes)

long write(int fd, void ∗buf, long nbytes)

DESCRIPTION

­Read reads ­nbytes bytes of data from the offset in the file associated with ­fd into memory at buf. The offset is advanced by the number of bytes read. It is not guaranteed that all ­nbytes bytes will be read; for example if the file refers to the console, at most one line will be returned.  In any event the number of characters read is returned.  A return value of 0 is conventionally interpreted as end of file. 

­Write writes ­nbytes bytes of data starting at ­buf to the file associated with ­fd at the file offset.  The offset is advanced by the number of bytes written.  The number of characters actually written is returned.  It should be regarded as an error if this is not the same as requested. 

SEE ALSO

intro(2), open(2), dup(2), pipe(2)

DIAGNOSTICS

These functions set ­errstr. 

Plan 9  —  January 03, 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026