realbasic-nug
[Top] [All Lists]

Re: Memoryblock question

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Memoryblock question
From: Charles Yeomans <yeomans at desuetude dot com>
Date: Fri, 31 Dec 2004 11:20:20 -0500
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20041230213934 dot 081C36284FD at lists dot realsoftware dot com> <DB3F217B-5AB9-11D9-97D8-000D9332E452 at netbox dot com> <2F8D6F30-5AC1-11D9-BA8A-000A957CB4CC at desuetude dot com> <9B0B3A9F-5ACA-11D9-8513-000A95687284 at zhameesha dot com>

On Dec 30, 2004, at 8:23 PM, Stuart Malin wrote:


On Dec 30, 2004, at 4:16 PM, Charles Yeomans wrote:
On Dec 30, 2004, at 6:23 PM, Ken Fleisher wrote:

Hi. I know this is a simple question, but I just have not been able to figure it out. I have data in a memoryblock and I want to put a portion of it into a string variable as hex code. I've been trying to use the following to transfer the data:

var = m.stringvalue( offset, size )

and variations on this. What I can't figure out is how to get the hex representation of the data. The data is not actually a string, so is there a different way to transfer an arbitrary block of data and store it as hex?



Here's one way:

For i = start to finish
  s = s + Hex(m.Byte(i))
Next

This example makes the point of the need to "hexify" the characters, but, given other threads on the immutableness of strings, I now cringe when I see:
        s = s + .....
in a For...Next loop.

Don't. For a small (<1000 or so) iterations, using String concatenation is usually good enough.


--------------
Charles Yeomans

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

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

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