Page 1 of 1

Strings are cut if more as 10 byte send by * Param [solved]

Posted: Wed Apr 20, 2016 1:52 am
by Rudi
FC 6.1.3.2 (18.02.2016)
hi

this was my base, and my solution for this.
but if i send more as 10 Bytes ( data + \0 ) then the string is cutting.
Scuts1.png

because the sbuffer is 20 ( sbuff[20] ) i think there can it be a bug in FC.
perhabs you can check it, would be fine

thank you.
best wishes

rudi ;-)

edit: solved
thanks Leigh, i edit the c code in FCM_helperFunc_X:

Code: Select all

int (*lf) ();
lf = ( unsigned short *) FCL_PADDR;

lf("DODO1\n");
// old
// lf(FCL_SBUFF);
// new
lf(FCL_SBUFF, FCLsz_SBUFF);

think now i understand the principal with strings in FC better.
this local copy of strings is same theme with char++
if i want make char++ then i do not use the local copy,
you gave me this last year, i remember me ;-)
have test to make send struct now too, and do the work
will update the fcx later time and upload a solution for sending structs.
thank you!
best wishes
rudi ;-)

Re: Strings are cut if more as 10 byte send by * Parameter

Posted: Wed Apr 20, 2016 8:37 am
by LeighM
Hi Rudi,
The issue is that when Flowcode macros have a string parameter the C code generated actually has two parameters, a string pointer plus the maximum string size. This string size is not being passed in your C code in FCM_helperFunc_X()
Regards,
Leigh

ps. Things will be a bit clearer if you remove the local string copy in the macro
no_local_copy.jpg
no_local_copy.jpg (33.62 KiB) Viewed 5936 times