RealBasic advice/help

Hi-

I feel like an idiot, but I guess that's what happens when you start learning a new language. I'm trying to import a resource in RealBasic--and can--but it's ASCII. I need it to be hex. Can anyone advise? I know EVO God must have to do exactly what I'm trying to do, so any advice or pointers to information on the web would make my life easier.

Thanks.

-STH

------------------

You'll have to be a bit more specific than that.

In the RB help under resources it says If you've imported a file called "resources" then you can use:

dim rf as resourcefork
rf.getresource(type, ID)

where type is string and ID is an integer. and it will return whatever resource you wanted as a string. So if you had a hex resource it would return the hex as a string but it would still be hex code.

But then if you been you want to open a file as binary rather than text all you need to do is:

Dim ReadFromFile as BinaryStream
Dim f as FolderItem
dim stuff as string

f=GetFolderItem("text")
ReadFromFile=f.OpenAsBinaryFile
stuff=readfromfile.read(21)
ReadFromFile.close

so that will open the file "text" as a binarystream then make stuff equal the first 21 characters in the binary stream.

All this stuff is in the help. It is very good, it will teach you everything, and I mean everything.

Hope this helps,
Tycho

------------------
Where the Hell's my roof?

well, basically you dont. It returns the resource as strings, but you can (painstakingly) convert this to hex, then add all the bits together etc. I think there is a plugin to do it, but that is the reason I stopped using RB.

------------------
--sitharus
'If not you, who else?'
(url="http://"mailto:sitharus@ureach.com")mailto:sitharus@ureach.com(/url)sitharus@ureach.com

Quote

Originally posted by blackhole:
**well, basically you dont. It returns the resource as strings, but you can (painstakingly) convert this to hex, then add all the bits together etc. I think there is a plugin to do it, but that is the reason I stopped using RB.
**

Yeah. I figured that out this morning (the painstaking part). I'll play around with it a bit more.

Thanks for the advice, all.

-STH

------------------