Page 1 of 1

Strings and Byte arrays

Posted: Tue Nov 26, 2019 8:25 pm
by mnf
Another strange bug..

I defined a macro returning a string... The variable I passed, however, was a byte array (aka a string :) )

This expanded to the following which then threw errors:
FCL_STR = FCM_ByteToHex(%[opn0%tmp%],%[len0%tsz%], FCL_X);
A simple demo showing this:
bug.fcfx
(6.41 KiB) Downloaded 205 times
Unfortunately the problem with FC not allowing this variable to be changed to a string (or strings back to byte arrays) meant it was bit more hassle than anticipated..

FC then bombed with the restart windows problem - which seems to be happening rather more often (I've maybe slipped a version on repair) - any progress sorting this?

Martin

Re: Strings and Byte arrays

Posted: Wed Nov 27, 2019 10:42 am
by Benj
Hi Martin,

A string and byte array in C are the same thing. In Flowcode they are slightly different in that a string when used as a parameter also passes the maximum size. Therefore this is what is causing the compilation error when you are using a byte array in place of the string.

A simple workaround for changing variable types in a macro is to duplicate the macro and when you are in the edit dialogue you can then change the various variable or parameter types. Another way is to edit the project file XML in a text editor but this is not ideal.
FC then bombed with the restart windows problem - which seems to be happening rather more often (I've maybe slipped a version on repair) - any progress sorting this?
We are investigating this but currently don't have a way of replicating the problem to allow us to get to the bottom of the problem. I had it happen several times a few months back but it has not returned since making me think it was something to do with the Windows environment maybe being in an unstable state while it updated itself.

Re: Strings and Byte arrays

Posted: Wed Nov 27, 2019 11:15 am
by mnf
Thanks Ben,

FC - sort of thinks the array of byte is the same too - should throw an 'Can't convert to type' error - instead of the cryptic compiler message? But, yes - it was my mistake really :-)

The windows bug doesn't seem to have a common cause. I thought I'd hit on something when it happened a couple of times when fiddling with some properties. Need to crank up the auto-backup frequency!

Martin