Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 920248 Details for
Bug 1122595
istream::readsome() fails on large files
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Source code for short program to demonstrate the problem
read_test.cpp (text/plain), 1.45 KB, created by
Ross Miller
on 2014-07-23 14:53:23 UTC
(
hide
)
Description:
Source code for short program to demonstrate the problem
Filename:
MIME Type:
Creator:
Ross Miller
Created:
2014-07-23 14:53:23 UTC
Size:
1.45 KB
patch
obsolete
>// This is a quick test to try to narrow down a possible bug in >// ifstream::readsome() > >#include <unistd.h> // for usleep() >#include <fstream> >#include <iostream> > >using namespace std; > >int main( int argc, char **argv) >{ > if (argc != 2) > { > cerr << "Usage: " << argv[0] << " <test_file>" << endl; > return 1; > } > > ifstream infile( argv[1], ios_base::binary | ios_base::ate); > if (! infile.good()) > { > cerr << "Failed to open " << argv[1] << endl; > return 2; > } > > const unsigned long fileSize = infile.tellg(); > infile.seekg( 0, ios_base::beg); > > const unsigned bufLen = 1024 * 1024; // 1MB reads > char *buf = new char[bufLen]; > > // readsome() doesn't set the eof bit, so manually calculate the eof > unsigned long bytesRemaining = fileSize - infile.tellg(); > while ( bytesRemaining) > { > cout << "Bytes remaining: " << bytesRemaining << endl; > streamsize bytesRead = infile.readsome( buf, bufLen); > if (bytesRead == 0) > { > cerr << "Read 0 bytes from infile. Position: " > << infile.tellg() << endl; > usleep(100 * 1000); // Maybe it's a temporary fs glitch? > } > else > { > cout << "Read " << bytesRead << " bytes" << endl; > } > > bytesRemaining = fileSize - infile.tellg(); > } > > cout << "Successfully read the file." << endl; > delete[] buf; > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1122595
: 920248