Post Reply 
71b creating strings with binary data
12-20-2022, 04:14 AM (This post was last modified: 12-20-2022 04:41 AM by dmh.)
Post: #1
71b creating strings with binary data
Hi, I'm trying to build binary data in a string for transmission via IL and the strings will contain unprintable characters including 0 (ie 0x00).

The problem I am having is that whenever I use CHR$() to place a value in a specific position in the string all preceding bytes with 0x00 in them are replaced with the space character.

Is there a way around this or a better way to do it? Resetting the spaces to 0x00 after CHR$() would be time consuming and error prone and I wanted the default to be 0x00 unless I assign a value.

I thought strings would be the best way to build such data and then output it all to IL using the string at once.

In the following example the string initially contains 0x00 but once CHR$() is used to place a value in character 5 the preceding characters are changed to space (even if I zero the preceding characters first after DIM).

Code:
DIM P1$[10]
NUM(P1$[1])
0
P1$[5,5]=CHR$(42)
NUM(P1$[1])
32

Any advise appreciated.

Edit: it doesn't matter if you use CHR$() or a character directly (eg "*") as the same issue occurs but as much of the data will be binary I will typically be using CHR$()

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
71b creating strings with binary data - dmh - 12-20-2022 04:14 AM



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