Page 1 of 1

General Flowcode String question

Posted: Tue Nov 26, 2013 12:54 pm
by Dave S
Hi all,

When a string is declared in C you add an extra byte for the "end of string" null character. For example a string to hold 1234 would be declared as STRING[5].
When using Flowcode Macro's to send or receive RS232 strings do we still allow for this null character or is it done by the Macro?
To send RS232 String 1234 do I declare STRING[4] or STRING[5]?

Thanks,

Dave

Re: General Flowcode String question

Posted: Tue Nov 26, 2013 1:01 pm
by dazz
HI
im a bit busy but check the flowchart at the bottom of this thread http://www.matrixmultimedia.com/mmforum ... ing#p36816

Regards
Dazz

Re: General Flowcode String question

Posted: Tue Nov 26, 2013 3:12 pm
by Dave S
Thanks Dazz but it won't open in Flowcode 4

Dave

Re: General Flowcode String question

Posted: Tue Nov 26, 2013 4:13 pm
by dazz
Hi Dave
Yeah sorry about that ive attached an html page(in a zipfile) that should have the program layed out so you can see tthe macros etc

Regards
Dazz
rs232StringMacro (1).zip
(1.09 KiB) Downloaded 382 times

Re: General Flowcode String question

Posted: Tue Nov 26, 2013 6:15 pm
by Dave S
Hi Dazz,

Can't see most of that either but I think I've answered my own question now. Macro send string will send all bytes declared, ie STRING[5] with 1234 will send 1234 and whatever gibberish is in the 5th byte. From that it looks as if the NULL at the end is transparent to the user.

Thanks for your help,

Dave

Re: General Flowcode String question

Posted: Thu Nov 28, 2013 10:03 am
by JonnyW
Hi Dave.

Yes, Flowcode works like C does with a null terminator but also knows how long a string is - if there is no null before the end of the string then it will not go over the end. In your example with a non-null character in the 5th byte this will be sent too, but nothing else from the end of that.

Jonny