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

A forums to allow bugs and problems with Flowcode v6 to be reported and resolved.

Moderator: Benj

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

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

Postby Rudi » Wed Apr 20, 2016 1:52 am

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 ;-)
Last edited by Rudi on Thu Apr 21, 2016 12:33 pm, edited 2 times in total.

User avatar
LeighM
Matrix Staff
Posts: 1844
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 429 times
Been thanked: 612 times
Contact:

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

Postby LeighM » Wed Apr 20, 2016 8:37 am

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 2052 times
These users thanked the author LeighM for the post:
Rudi (Wed Apr 20, 2016 9:13 am)
Rating: 5.56%