Page 1 of 1
string array problem
Posted: Tue Nov 08, 2022 12:21 pm
by Maverick
Any suggestions as to why the attached flowcode appears to add the array index to the end of the string to be printed apart from the last. i have tried it with a ssd1306 display with the same result. this is simulation only, I haven't tried actual hardware yet
Re: string array problem
Posted: Tue Nov 08, 2022 6:02 pm
by mnfisher
The strings are 24 characters - if you allow space for a \0 end of string marker then all is well (set string length to 25 in this case).
It looks like Print is looking for a \0 character as end of string rather than using the length passed (FC passes string and str_length to a function)
Martin
Re: string array problem
Posted: Wed Nov 09, 2022 9:53 am
by BenR
Hello,
It looks like it's probably a bug on our end to do with multidimensional strings without null bytes. The Length$ function is maybe being passed the entire size of the array rather than the correct array chunk size.
We will look into solving it in the application but for now the best practise would be to use Martins suggestion and make room for the null bytes to be automatically added for you. In general it is good coding practise to allow for an extra byte in your string variable to make room for the null.