Generic word contract Reads up to n elements from the stream. The data is stored directly into the buffer provided by buf, which must be a string (in the case of a character stream) or a byte array, specialized array, or other pointer to memory (in the case of a byte stream). There must be space in the buffer for at least n elements. Returns the number of elements read from the stream, which will be equal to n unless the end of the stream is reached. If the stream is exhausted, returns zero.