[futurebasic] Re: [FB] STR# resource

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2003 : Group Archive : Group : All Groups

From: barrie <barrie@...>
Date: Sun, 20 Apr 2003 18:39:48 -0400
on 4/20/03 5:49 PM, Alain Pastor at pixmix@... wrote:

> barrie wrote:
>> I have two strings in a STR# resource that need to be replaced with
>> different strings. I can find reference on reading and appending strings
>> but can't find anything on replacing strings in a STR# resource. Can someone
>> please help.
>> Barrie
> Barrie,
> Below is a piece of code that emulates the GetIndString function
> frequently found in C code (almost the same as the FB STR# function).
> As a bonus there is also a SetIndString function that allows to set a
> specific item in a string list resource. However, for your particular
> need I think the code provided by Al and Bob should be what you need.
> Caution with line breaks:

>     Unfortunately, nothing is provided by the Toolbox to change the STR#
>     resources on the fly.
>     First, the purpose of resources is not to store data that change
>     frequently; second, it is clearly NOT RECOMMENDED to alter the
> resources of
>     a running program. If you do so your program won't be able to
> run from a
>     locked volume such as a CD-ROM or from a file server.
>     Inspired by Apple's documentation, below is a function that
> allows you to
>     set a specific string within a STR# resource. Use at your own
> risk...
>                                                    Alain Pastor {
Thanks for the education. I didn't realize that resources should not be
altered. Now I know why I couldn't find an easy way to change the STR#
strings. I re-thought the problem and decided that I can do without the
changed resource. Many thanks to all, I learned a lot about using resource