[futurebasic] Re: [FB] Defining strings of arbitrary length?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2000 : Group Archive : Group : All Groups

From: Robin <robinc@...>
Date: Mon, 30 Oct 2000 08:41:52 +1000
>> dim 27 myStr27$
>> dim 8  myStr8$ // actually allows 9 characters max
> 
> Just to clarify, wouldn't 'dim 8  myStr8$' dim 8 bytes for myStr8$.
> Since this is a pascal string, the first byte holds the length.  That
> would leave 7 bytes for characters, right?  Or does FB^3 add a the
> byte for the string length?

No, the DIM in strings defines how many characters you can have: DIM 8
myStr8$ gives you 8 bytes for characters. FB always gives you the 0'th byte
for the length. Since strings are adjusted to even boundaries, it then
leaves an unused byte at the end to give a total number of bytes assigned of
10. Note that if you have overflow checking on, although there are 9 bytes
"there", you are still only allowed to put 8 into the string.

-- 
Robin
====================================================
Genesearch Pty Ltd
E-mail: robinc@...
WWW:    http://www.genesearch.com.au
====================================================