Post Reply 
71b creating strings with binary data
12-20-2022, 10:57 AM
Post: #4
RE: 71b creating strings with binary data
(12-20-2022 10:07 AM)dmh Wrote:  I actually did exactly that but didn't show it in the example above. I dimensioned the string, looped and set every character to 0x00 and then set a character in the middle of the string and all the preceding characters get set to space.

I can't reproduce it.
>DIM A$[10]
>FOR I=1 TO 10 @ A$[I,I]=CHR$(0) @ NEXT I
>LEN(A$)
10
>NUM(A$[2])
0
>A$[5,5]="A"
>NUM(A$[2])
0


(12-20-2022 10:07 AM)dmh Wrote:  How did you do it?
Do I need the length of the string set first so the 0x00's are not replaced?

I usually do it in this way:
I append all the bytes successively, in order, so the length is automatically managed.
DIM A$[N]
A$=""
FOR I=1 TO N
A$=A$&CHR$(x) ! append any byte including null
NEXT I

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 71b creating strings with binary data - J-F Garnier - 12-20-2022 10:57 AM



User(s) browsing this thread: 6 Guest(s)