Hi Massimiliano, Something is definitely awry, since: S02B0000433A5C4C61766F72695C6265725C626F6F746C6F61645C6B65726E656C5C6B65726E 656C5C516B6C0B Is 90 characters long (ignoring the line break), not 95 in your test_ok and test_nook examples. Something is off-by-5. Very odd. It also appears that your end-of-line marker is a single character long. CR (\r, 0x0D -- ala old Mac OS 9 era and prior, Apple DOS, ProDOS, GS/OS) or LF (\n, 0x0A -- Unix, ECMA-94, USASCII, Amiga, modern Mac OS X, Cygwin on Windows (w/appropriate environmental setting), et cetera) based. Rather than two character CR-LF (\r\n, 0x0D 0x0A) end-of-line sequence based, like CP/M or DOS or OS/2 or Windows or Windows NT. (The gist being that the issue is not std::ios_base::binary setting related.) Sincerely, --Eljay