Hi Roger,
Are you expecting the FN to give the number of elements? If so, then it
must specify the value to return. Change the "END FN" to "END FN =
totStr%".
Keep in mind that this FN also loads in the str# resource into an INDEX$
array. If you just need the number of elements, then use something like
this:
LOCAL FN getNumStrElements (id)
DEFSTR LONG
strHndl&=FN GETRESOURCE(_"STR#", id)
LONG IF strHndl&
totStr% = ([strHndl&])
XELSE
totStr% = 0
END IF
END FN = totStr%
HTH,
Jason
>I am in need of help finding the number of elements in a str# resource.
>According to the FBII manual (p. 206) this FN should return the number of
>elements in totStr%:
>
>LOCAL FN getStrs (id)
> DEFSTR LONG
> strHndl&=FN GETRESOURCE(_"STR#", id)
> LONG IF strHndl&
> size& = FN SIZERESOURCE(strHndl&)
> totStr% = ([strHndl&])
> CLEAR size&
> FOR j = 1 TO totStr%
> INDEX$(j-1) = STR#(id, j)
> NEXT j
> XELSE
> totStr% = 0
> END IF
>END FN
>
>but I get a 5-digit number when this FN is run as is. Changing it to:
>
>totStr% = ({strHndl&})
>to peek WORD instead of LONG produces a 3 digit number (There are 3
>elements in my str#)
>
>What is the correct way to determine number of elements?
>
>TIA
>
>
>
>
>Roger M. Clary
>MacMuse Software
>macmuse@...
>http://members.aol.com/macmuse
>
>--
>To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>