[prev] 44 [next]

File System Operations (cont)

ssize_t write(int FileDesc, void *Buffer, size_t Count)

  • attempt to write Count bytes from Buffer onto FileDesc
  • if "successful", return number of bytes actually written (NWritten)
  • if unsuccessful, return -1 and set errno
  • does not check whether Buffer has Count bytes of data
  • advances the file offset by NWritten bytes

[Diagram:Pics/opsys/write.png]

Why might write() return NWritten < Count?