Prevent fixed string problem within StructureUnion...

Just starting out? Need help? Post your questions and find answers here.
Joris
Addict
Addict
Posts: 890
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

Prevent fixed string problem within StructureUnion...

Post by Joris »

Hi,

I suppose the problem (d\st) here is that #NUll byte.
But is there another way to prevent the problem without using Rset and Trim ?

Thanks

Code: Select all

Structure TEST
  StructureUnion
    st.s{#MAXPNAMELEN * 2}   
    io.s{#MAXPNAMELEN}[2]   
  EndStructureUnion
EndStructure

Global d.TEST, s.s{#MAXPNAMELEN}

;s="a string shorter then 32"                         ;s doesn't help while s =>  s.s{#MAXPNAMELEN}
;d\io[0]=s
;d\io[0]="a string exact length of 32 byte"
d\io[0]="a string shorter then 32"
d\io[1]="added to a string longer then 32.."
Debug d\io[0]
Debug d\io[1]
Debug d\st                                                 ;both io are only kept if io[0] is at least 32 bytes long

d\st="a string shorter then 32 added to a string longer then 32.."
Debug d\io[0]
Debug d\io[1]
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.