[futurebasic] Re: [FB] String$ in code resource

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1998 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Sun, 27 Dec 1998 12:23:24 +0100

Sylvain Guillemette wrote:

> I'm working on a code resource and i want to use string$ of text
> in it, but i don't want the text to be stored in a str resource.
>
> The only way i found is to generate the string 'on the fly',
> but it's not very practical:
>
> message$ = CHR$(69) + CHR$(114) + CHR$(114) + CHR$(111) + CHR$(114)
>
> Is there any other way i could do it ?
>

Hello Sylvain,

Maybe you could try to store your message$ with the data statement then read
the values as you need them.
Actually, I don't know where the compiler puts those values when the program
is built with the mini-runtime, but it could be an answer to your question.
Here is a little piece of code that explains better than I what I mean. You
could change the chars by their ASCII values and modify the function to take
this change in account.

Alain

CLEAR LOCAL MODE
DIM nbChars,start,i
DIM myMessage$,theChar$

LOCAL FN buildNprintString(whichone)
  RESTORE
  LONG IF whichone > 1
    FOR i = 2 TO whichone
      READ start
      nbChars = nbChars + start + 1
      RESTORE nbChars
    NEXT
  END IF
  READ nbChars
  FOR i = 1 TO nbChars
    READ theChar$
    mymessage$ = mymessage$ + theChar$
  NEXT
  PRINT mymessage$
END FN


WINDOW 1
FN buildNprintString(3)
FN buildNprintString(1)
FN buildNprintString(2)
DO
UNTIL FN BUTTON OR LEN(INKEY$)

DATA 24,C,A,U,T,I,O,N,!," ",T,h,i,s," ",i,s," ",a," ",t,e,s,t,"."
DATA 14,A,n,o,t,h,e,r," ",s,t,r,i,n,g
DATA 17,t,h,e," ",t,h,i,r,d," ",m,e,s,s,a,g,e