I'm new to binary-file handling and try to work/learn playing around
with MD5.
Now everything works fine with small files, but when files get
bigger(e.g. 28MB) this loop stops in the second read()! I don't know
why!
typedef basic_ifstream<unsigned char> ifstream_uc;
void MD5::update (unsinged char *input, unsinged int input_length)
{...}
void MD5::update(ifstream_uc& stream){
unsigned char ubuffer[1024];
unsigned int len;
while (stream.good()){
cout << ( stream.rdstate( ) & ios::badbit ) << endl;
cout << ( stream.rdstate( ) & ios::failbit ) << endl;
cout << ( stream.rdstate( ) & ios::eofbit ) << endl << endl;
stream.read(ubuffer, 1024); // note that return value of read is
unusable.
cout << ( stream.rdstate( ) & ios::badbit ) << endl;
cout << ( stream.rdstate( ) & ios::failbit ) << endl;
cout << ( stream.rdstate( ) & ios::eofbit ) << endl << endl << endl;
len=static_cast<unsigned int>(stream.gcount());
update(ubuffer, len);
}
}
0
0
0
0
0
0
0
0
0
0
2
1
Regards,
eiji