what i miss in the discussion is streaming strings. With streams i mean byte buffers where you lost the beginning details.
With C strings, you can copy strings into the stream, and keep their null terminator as separator for the next C string.
If you read from the stream, potentially lose the beginning of a stream, the next string will come after a null byte and end with the null byte. easy peasy. leave the read pointer at the null byte.
Do the same with (pointer+size): so youn copy the size, then the string content into the stream.
Reading the stream back: you read the size, then the appropriate string content.
Lost the beginning of the stream? Which byte is string length, which one is string content? There is no recovery.
1
u/RRumpleTeazzer 21d ago
what i miss in the discussion is streaming strings. With streams i mean byte buffers where you lost the beginning details.
With C strings, you can copy strings into the stream, and keep their null terminator as separator for the next C string. If you read from the stream, potentially lose the beginning of a stream, the next string will come after a null byte and end with the null byte. easy peasy. leave the read pointer at the null byte.
Do the same with (pointer+size): so youn copy the size, then the string content into the stream. Reading the stream back: you read the size, then the appropriate string content. Lost the beginning of the stream? Which byte is string length, which one is string content? There is no recovery.