This shouldn't be an int, but a std::streampos. Not that I expect any 2GB+ wallets any time soon, of course :)