gettingstarted
[Top] [All Lists]

Re: Option Characters to binary

To: "Getting Started" <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Option Characters to binary
From: Christopher Morrill <morrill at pacbell dot net>
Date: Wed, 19 Nov 2003 14:06:34 -0800
References: <200311191406 dot hAJE6ONp019178 at mtac1 dot prodigy dot net>
On November 19, Peter Gatti wrote:

I went nuts trying to figure out why just a few text strings were
screwing-up a binary file. I finally figured out why. It turns out, only
those strings that had a meta or option key character in them were the
ones responsible.

 I doubt that I'm doing anything wrong because the other strings save
without a problem. So is this a bug or just an RB limitation?

Yes -- I ran into the same problem, corrupting some or all byte values with the first bit set (ASC values > 127).

Evidently RB cannot write strings as pure binary data. It insists on performing some kind of text conversion -- even when writing to a binary file.

This may be considered a "feature," not a bug. To me, however, the whole point of a binary file is to store data in the form we choose -- not "converted" as somebody else sees fit.

In my case, my program is producing an RTF file, and the text conversion being "helpfully" interposed by RB resulted in corruption of the file. As a work-around, I was forced to loop through every output string, byte by byte, writing each byte individually. Perhaps there's a better way.

Christopher



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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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