нам не нужно использовать std :: fstream, мы используем boost :: iostream
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
void main()
{
namespace io = boost::iostreams;
//step1. open a file, and check error.
int handle = fileno(stdin); //I'm lazy,so...
//step2. create stardard conformance streem
io::stream<io::file_descriptor_source> s( io::file_descriptor_source(handle) );
//step3. use good facilities as you will
char buff[32];
s.getline( buff, 32);
int i=0;
s >> i;
s.read(buff,32);
}