write (system call)

The write is one of the most basic routines provided by a Unix-like operating system kernel.

It writes data from a buffer declared by the user to a given device, such as a file.

This is the primary way to output data from a program by directly using a system call.

The data to be written, for instance a piece of text, is defined by a pointer and a size, given in number of bytes.

The write function returns the number of bytes successfully written into the file, which may at times be less than the specified nbytes.