Re: Help - I'm at wit's end...

From: Paul Russell (prussell_at_sonic.net)
Date: 12/29/04


Date: Wed, 29 Dec 2004 22:26:43 GMT

Don Bruder wrote:
>
> That was my next thought. However, if there's anything that has any
> chance to swap newlines for carriage returns, I can't find it. Add in
> the fact that this "inversion" *DOES NOT* happen when the exact same
> code (just called by a different mainline routine that gets its data
> from the FIPS test files rather than a ".torrent" file or its target))
> is handed the FIPS test vectors - when using the FIPS vectors, I get
> exactly the expected results - and I come up with "That's probably not
> it either".
>
> Which is why I'm questioning my own sanity...
>
> I'm looking at a situation that would *SEEM* to be impossible based on
> observable facts and the "rules" as I understand them, but it's
> happening anyway!
>

Make sure that when you open binary files you open them with the "b"
flag, e.g.

FILE * f = fopen("foo", "rb");

rather than

FILE * f = fopen("foo", "r");

otherwise you'll get weird behaviour with bytes that map to CR or LF.

Paul