[Dev-C++] file.read() dosn't read all it should read
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jakob E. <mai...@ko...> - 2005-02-18 11:52:34
|
Ok, here is the thing. I'm trying to read from a file. But for some reason the entire file wont = =20 read. It's really strange becaus fstream::read() is suposed to read all the dat= a =20 at once (unlike readsome() ) Has any one of you ever run in to this problem. The source: //get the filesize=09 file.seekg( 0,ios_base::end ); file_size =3D file.tellg(); file.seekg( 0,ios_base::beg ); p_buffer =3D new char[file_size]; cout << "file size:" << file_size<<endl; file.read(p_buffer, file_size); cout << "gcount: "<< file.gcount()<<endl; ap_socket->send(p_buffer, file_size); delete p_buffer; the output: file size:6090 gcount: 5 |