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 03:04:05 +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> <3E14F3DA-1A0F-47A7-A23A-5561C8EFDFC3 at rbclass dot com> <A0720DC7-6E68-4825-B1E7-06FA772B07E7 at inspiringapps dot com>
Hi Joe,

On 29 Mar 2008, at 02:07, Joe Strout wrote:

> You can read and write strings in binary files just fine, but as with
> any binary file, you have to define (i.e. make up) the format.
> Perhaps you'll choose to write out the length in bytes as a long
> integer, followed by the data in UTF-8 format.  Upon reading, do the
> reverse (and remember to define the encoding as UTF-8).  This is
> similar to PString, but removes the 255-byte limit and uses a more
> sensible encoding.

Gotcha. I think! But...

> Or, just use a text stream; that's certainly much easier if all your
> data is text.

Well, that's what I thought I'd do... so I re-wrote my entire prefs  
file saving routine to use a TextOutputStream instead... And you'll  
never guess what...? Yup, the © character STILL saves that funny  
little character before it.

I checked my code, and I even hard-coded the following:

   if f<> nil then
     txtOut=f.CreateTextFile
     txtOut.WriteLine("CopyrightText=©") // notice this line
     txtOut.Close
   end if

but this is the result I get in the file...

CopyrightText=©

Am I missing something here?

If anything, this points to the fact that it wasn't the WritePString's  
fault - and as I've hard-coded that text and writing to a text stream,  
what am I doing wrong?

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>