realbasic-nug
[Top] [All Lists]

Re: WritePString weirdness...

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: WritePString weirdness...
From: Mark O'Neill <real at rbclass dot com>
Date: Sat, 29 Mar 2008 01:10:07 +0000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <226027DE-9E67-4701-90AD-12E8F3383CF6 at rbclass dot com> <A652AB13-FCF7-4D95-B6B1-5EC6EC3E84DE at inspiringapps dot com>
Hi Joe,

On 28 Mar 2008, at 19:27, Joe Strout wrote:

> I don't recommend that.  PStrings are an old Mac OS 9 thing; they
> aren't particularly encoding-savvy, and of course they don't support
> strings greater than 255 bytes (that's bytes, not characters).
>
> The problem you're seeing is no doubt that ReadPString, being a
> legacy function only intended for reading old Mac OS 9 files (which
> used WorldScript rather than Unicode), has not properly defined the
> encoding of the string.  You could correct this with DefineEncoding,
> but I recommend you quit using PStrings for your own data entirely.

Ah, right. Didn't know that. I just opened the BinaryStream example  
that was shipped with RB - having never worked with files in RB before  
- and that's what they used in the example.

What should I use instead for storing text? I don't see a ReadString  
or WriteString in the help file or the contextual helper - or should I  
just avoid BinaryStreams for preference files and just use a text file?

All the best,

Mark.
------------------------------------------------------------
RB Class
"Killer Tool Bar" - theme-based x-platform toolbar
www.rbclass.com



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>