Descriptors and five calls
To a process, a file is a sequence of bytes. The process does not hold the inode; it holds a descriptor — a small non-negative integer indexing its descriptor table. By convention 0 / 1 / 2 are stdin, stdout and stderr. open returns the lowest free number; close frees it.
Five calls do most of the work: open, read, write, lseek, close. Each read/write transfers up to the requested count and returns how many bytes actually moved (0 from read means end of file). lseek moves the offset. Worked example. On a 10-byte file, lseek(-2, SEEK_END) leaves the offset at 8, so the next read of 2 bytes gets the last two.
Short counts are normal: read may return less than asked when the pipe has only that much ready; write to a pipe may accept less when the pipe buffer is nearly full. Robust code loops until the intended transfer finishes or an error/EOF stops it — the same discipline sockets needed for TCP streams.