This function reads bytes from a socket or file and places them in a user-defined buffer. If the end of file is not reached, the read() function returns nbytes. If the end of file occurs during the read() function, it returns the number of bytes read. Upon successful completion, read() returns the number of bytes actually read and placed in the buffer. Related Functions See also socket().