SA
Skip to main content

Handling files in Unix

Read

The return value can be:

  • -1: error
  • 0: EOF
  • n: n bytes of data in the first n bytes of the buffer

Write

The return value can be:

  • -1: error
  • 0: write again with a new message
  • n: n bytes of data in the first n bytes of the buffer are consumed by OS