Sam's Blog
Saturday, 4 May 2013
Binary file read by std::ifstream is corrupted
By default, std::ifstream is constructed with text mode. On windows, it will convert new line character which may corrupt the binary file.
The fix is to use std::ifstream::binary as the second parameter when construct ifstream for binary file.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment