71b creating strings with binary data
|
12-20-2022, 09:50 AM
Post: #2
|
|||
|
|||
RE: 71b creating strings with binary data
Using strings with binary data is usually no problem. I did it a lot of time.
However, the BASIC string type is not an array of bytes, but a string of characters associated with a length. When you set the value of a character before setting the preceding bytes, these ones are not replaced by spaces, they are, by default, initialized as spaces. Doing NUM beyond the current length of the string returns 0, not the (default) value of the character that is at this point outside the string. If you don't set the value of each byte of the string, it means that they are don't care for you, so it shouldn't matter if there are spaces or nulls. If it really matters for you, then you should initialize the string: DIM P1$[10] P1$=RPT$(CHR$(0),10) or a loop if you don't have a LEX with the RPT$ keyword. J-F |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
71b creating strings with binary data - dmh - 12-20-2022, 04:14 AM
RE: 71b creating strings with binary data - J-F Garnier - 12-20-2022 09:50 AM
RE: 71b creating strings with binary data - dmh - 12-20-2022, 10:07 AM
RE: 71b creating strings with binary data - J-F Garnier - 12-20-2022, 10:57 AM
RE: 71b creating strings with binary data - Garth Wilson - 12-20-2022, 08:22 PM
RE: 71b creating strings with binary data - dmh - 12-21-2022, 12:21 AM
RE: 71b creating strings with binary data - KeithB - 12-21-2022, 04:28 PM
|
User(s) browsing this thread: 4 Guest(s)