and__"REALbasic_Gem".html" title="Wow! A "New Thing" <em>and</em> "REALbasic Gem"" />

Oy, nasty little fact that'll catch ya

| | Comments (0)

I learned something new today. I was reviewing the new language reference contents and I stumbled across what I thought was a bug in the docs pertaining to BinaryStream. It claimed that the LittleEndian property for a BinaryStream defaults to false. Always. Regardelss of the platform.

I thought, surely this is bunk. I mean, MemoryBlock.LittleEndian defaults to the proper value depending on the platform. BinaryStream must follow suit.

Nope, it doesn't. BinaryStream.LittleEndian defaults to *false* on Windows and Linux. So if you're writing an application that you expect to deploy which requires BinaryStreams to have platform-endianness, make sure you set it up yourself or you're in for a nasty surprise.

The "good" thing about this is if you write a BinaryStream file out, bring it over to another OS and read it back in, it "just works." Basically, it lets you ignore endianness. The downside is that you'll get caught when you try to read files from other applications.

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.