encyclopegia.org

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 destination is identified by a numeric code. The data to be written, for instance a piece of text, is defined by a pointer and a size, given in number of bytes. write thus takes three arguments: # The file code (file descriptor or fd). # The pointer to a buffer where the data is stored (buf). # The number of bytes to write from the buffer (nbytes).

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 destination is identified by a numeric code. The data to be written, for instance a piece of text, is defined by a pointer and a size, given in number of bytes. write thus takes three arguments: The file code (file descriptor or fd). The pointer to a buffer where the data is stored (buf). The number of bytes to write from the buffer (nbytes). ssize_t write(int fildes, const void* buf, size_t nbyte); In above syntax, ssize_t is a typedef . It is a signed data type defined in stddef.h . Note that write() does not return an unsigned value; it returns -1 if an error occurs so it must return a signed value. The write function returns the number of bytes successfully written into the file, which may at times be less than the specified nbytes. It returns -1 if an exceptional condition is encountered, see section on errors below.

References

  1. http://www.unix.com/man-page/FreeBSD/2/write/ Manual page for Write Wikipedia revision 1321200360, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "http://www.unix.com/man-page/FreeBSD/2/write/ Manual page for Write Wikipedia revision 1321200360, retrieved 2026-11-19." http://www. 2026-11-18. http://www.unix.com/man-page/FreeBSD/2/write/. Accessed 24 November 2026.

    Chicago "http://www.unix.com/man-page/FreeBSD/2/write/ Manual page for Write Wikipedia revision 1321200360, retrieved 2026-11-19." http://www. 2026-11-18. http://www.unix.com/man-page/FreeBSD/2/write/.

    APA http://www. (2026). http://www.unix.com/man-page/FreeBSD/2/write/ Manual page for Write Wikipedia revision 1321200360, retrieved 2026-11-19. Retrieved November 24, 2026, from http://www.unix.com/man-page/FreeBSD/2/write/

  2. https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives I/O Primitives Wikipedia revision 1321200360, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives I/O Primitives Wikipedia revision 1321200360, retrieved 2026-11-19." https://www. 2026-11-18. https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives. Accessed 24 November 2026.

    Chicago "https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives I/O Primitives Wikipedia revision 1321200360, retrieved 2026-11-19." https://www. 2026-11-18. https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives.

    APA https://www. (2026). https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives I/O Primitives Wikipedia revision 1321200360, retrieved 2026-11-19. Retrieved November 24, 2026, from https://www.gnu.org/s/hello/manual/libc/I_002fO-Primitives.html#I_002fO-Primitives

  3. Write · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "Write." 2026-11-18. http://pubs.opengroup.org/onlinepubs/007904875/functions/write.html. Accessed 24 November 2026.

    Chicago "Write." 2026-11-18. http://pubs.opengroup.org/onlinepubs/007904875/functions/write.html.

    APA encyclopegia.org. (2026). Write. Retrieved November 24, 2026, from http://pubs.opengroup.org/onlinepubs/007904875/functions/write.html

  4. linux/arch/x86/entry/syscalls/syscall_64.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "linux/arch/x86/entry/syscalls/syscall_64.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/arch/x86/entry/syscalls/syscall_64. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/x86/entry/syscalls/syscall_64.tbl. Accessed 24 November 2026.

    Chicago "linux/arch/x86/entry/syscalls/syscall_64.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/arch/x86/entry/syscalls/syscall_64. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/x86/entry/syscalls/syscall_64.tbl.

    APA "linux/arch/x86/entry/syscalls/syscall_64. (2026). linux/arch/x86/entry/syscalls/syscall_64.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux. Retrieved November 24, 2026, from https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/x86/entry/syscalls/syscall_64.tbl

  5. linux/arch/arm64/tools/syscall_32.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "linux/arch/arm64/tools/syscall_32.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/arch/arm64/tools/syscall_32. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/arm64/tools/syscall_32.tbl. Accessed 24 November 2026.

    Chicago "linux/arch/arm64/tools/syscall_32.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/arch/arm64/tools/syscall_32. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/arm64/tools/syscall_32.tbl.

    APA "linux/arch/arm64/tools/syscall_32. (2026). linux/arch/arm64/tools/syscall_32.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux. Retrieved November 24, 2026, from https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/arch/arm64/tools/syscall_32.tbl

  6. linux/scripts/syscall.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "linux/scripts/syscall.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/scripts/syscall. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/scripts/syscall.tbl. Accessed 24 November 2026.

    Chicago "linux/scripts/syscall.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/scripts/syscall. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/scripts/syscall.tbl.

    APA "linux/scripts/syscall. (2026). linux/scripts/syscall.tbl at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux. Retrieved November 24, 2026, from https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/scripts/syscall.tbl

  7. linux/include/uapi/linux/unistd.h at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux · retrieved 2026-11-18 · rev 1321200360
    Cite this reference

    MLA "linux/include/uapi/linux/unistd.h at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/include/uapi/linux/unistd. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/include/uapi/linux/unistd.h. Accessed 24 November 2026.

    Chicago "linux/include/uapi/linux/unistd.h at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux." "linux/include/uapi/linux/unistd. 2026-11-18. https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/include/uapi/linux/unistd.h.

    APA "linux/include/uapi/linux/unistd. (2026). linux/include/uapi/linux/unistd.h at fb4d33ab452ea254e2c319bac5703d1b56d895bf · torvalds/linux. Retrieved November 24, 2026, from https://github.com/torvalds/linux/blob/fb4d33ab452ea254e2c319bac5703d1b56d895bf/include/uapi/linux/unistd.h

Cite this article

MLA

"Write (system call)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/write-system-call. Accessed 24 November 2026.

Chicago

"Write (system call)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/write-system-call.

APA

encyclopegia.org. (2025). Write (system call). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/write-system-call

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Applicant Tracking System

article · references available

Solar System

stub · references available

binary numeral system

stub · references available

calendar system

stub · references available

centimeter–gram–second system of units

stub · references available

judicial system of Ukraine

stub · references available

Mac operating system

stub · references available

Public distribution system

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1321200360 · 0.5 · snapshot enwiki-001321200360

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.