the CREAD CWRITE docs said: "CAST_TO groups individual variables together as a single buffer."
KSS 8.2.16, creat a new program like below:
QuoteDisplay MoreDEFDAT test PUBLIC
DECL CHAR bytes[4]
bytes[1]=0
bytes[2]=0
bytes[3]=0
bytes[4]=0
ENDDAT
QuoteDisplay MoreDEF test( )
DECL CHAR buffer[4]
DECL INT i,OFFSETFOR i=1 TO 4
buffer[i]=0
ENDFOROFFSET=0
CAST_TO(buffer[],OFFSET,2)
bytes[]=buffer[]END
run the test.src, then check the value of bytes[] in .dat, it became
QuoteDisplay MoreDEFDAT test PUBLIC
DECL CHAR bytes[4]
bytes[1]="'H02'"
bytes[2]="'H00'"
bytes[3]="'H00'"
bytes[4]="'H00'"
ENDDAT
change the test.src and run again
QuoteDisplay MoreDEF test( )
DECL CHAR buffer[4]
DECL INT i,OFFSETFOR i=1 TO 4
buffer[i]=0
ENDFOROFFSET=0
CAST_TO(buffer[],OFFSET,-2)
bytes[]=buffer[]END
but the value did not change, it is:
QuoteDisplay MoreDEFDAT test PUBLIC
DECL CHAR bytes[4]
bytes[1]="'H02'"
bytes[2]="'H00'"
bytes[3]="'H00'"
bytes[4]="'H00'"
ENDDAT
so , I think the cast_to() do not support minus number. Is it right?
or something wrong with the codes?