Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 2.4

COLUMN

Cross platform streams

We write our own binary stream to save our data

Issue: 2.4 (March/April 2004)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 12,858
Starting Page Number: 42
Article Number: 2421
Resource File(s):

Download Icon 2421.zip Updated: 2013-03-11 19:07:57

Related Link(s): None

Excerpt of article text...

Why Our Own Binary Stream?

The idea behind this article is that you often need a way to store your data in some binary files. With REALbasic, on the Mac you can often simply use BinaryStream.WritePString to write a short string to a binary file, but this method has some limitations. First, a Pascal string has a maximum of only 255 characters, which may not be sufficient for uses such as the printer setup string (which is a few kilobytes in size on Mac OS X). Second, the string encoding is not stored inside the file, so you need to convert the encoding before saving.

This article shows you, in source code, how to make a cross platform binary stream which should work on Mac OS X, Mac OS Classic, Windows, and even Linux.

...End of Excerpt. Please purchase the magazine to read the full article.