Article Preview
Buy Now
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):
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.