From: Benjamin R. <Ben...@ep...> - 2003-05-21 22:01:33
|
Hi Alan, Oscar, Oscar Fuentes <of...@wa...> writes: > I think this is the problem: > > WRITELONG( '8BPS' ); > > In C++, how the compiler handles multibyte character constants is > implementation-defined. I guess the same applies to C. Ah, it's about those. Yes, what '8BPS' actually means here is more or less undefined, neither its integer value nor its actual byte-order is specified. We know that it has type "int" or "long", but that's about all we know from the language POV. Unless of course the compiler makes it an extension to explicitly document how it's supposed to work, like the compilers on MacOS do it. But I don't believe gcc has ever made any garantees about this, at least not on platforms other than MacOSX. Alan, you should use char[4] instead, if you can do that. Otherwise you need to write special binary parsers/formatters just for these kind of type codes, with their actual implementation depending on the compiler. Also make sure that they are separate from the parsers/formatters for int/long. so long, benny |