Short reads occur
-
If only 5 unread bytes remain, but the next read asks for 80 bytes, only 5 are read.
-
If the read function is used to read from the keyboard, it will only read at most one line for each call.
So a short read can occur if the line length is smaller than the bytes requested.
-
If read is reading from a network connection, read may return after only a portion of the requested data has been read because of network delays.