Reads at most len bytes from the file at the specified pos into the buf array.
the number of bytes read, or -1 if the end of the file is reached
if an I/O error occurs