Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ write(2) — Ultrix-11 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

open(2)

pipe(2)

write(2)

NAME

write − write on a file

SYNTAX

int write(fildes, buffer, nbytes)
int fildes;
char *buffer;
unsigned nbytes;

DESCRIPTION

A file descriptor fildes is a word returned from a successful creat, dup, fcntl, open, or pipe call. 

The specified buffer is the address of nbytes contiguous bytes which are written on the output file.  The number of characters actually written is returned.  It should be regarded as an error if this is not the same as requested. 

If the O_APPEND flag of the file status flags is set, the file pointer will be set to the end of the file prior to each write. 

Writes which are multiples of 1024 characters long and begin on a 1024-byte boundary in the file are more efficient than any others. 

DIAGNOSTICS

The write call will fail if:

[EBADF] The specified fildes is not a valid descriptor open for writing. 

[EFAULT] The specified address is odd or, when dealing with disk character special files, the count is odd. 

[EFAULT] The buffer points to an address outside the process’s allocated address space. 

[EFBIG] An attempt was made to write a file that exceeds the maximum file size. 

[ENXIO] The specified /dev/mem address is illegal. 

[EPIPE and SIGPIPE signal]
An attempt is made to write to a pipe that is not open for reading by any process.

[EQUOT] An attempt was made to write a file that exceeds a quota governing the file. 

[ETPL] The tape tape position was lost or the tape went offline during a write. 

[EINTR] A signal was caught during a write call. 

[ENOSPC] There is no free space remaining on the device containing the file. 

ASSEMBLER

(write = 4.) 
(file descriptor in r0)
sys write; buffer; nbytes
(byte count in r0)

SEE ALSO

creat(2), open(2), pipe(2)

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