#include <iostream>streamsize readsome(char *buf, streamsize num);
The readsome( ) function is a member of istream.
The readsome( ) function reads num bytes from the associated input stream and puts them in the buffer pointed to by buf. If the stream contains less than num characters, that number of characters are read. readsome( ) returns the number of characters read. The difference between read( ) and readsome( ) is that readsome( ) does not set the failbit if there are less than num characters available.
Related functions are gcount( ), read( ), and write( ).