I wonder if there's maybe a better way to do this?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Hello, yes there is a better way. Check out the standard library type: std::string::SizedString
from the type.magic
library. In this case you'd use it like this:
import type.magic;\n\nstd::string::SizedString<u8> string @ 0x0a;
-
Hi, I have the following data which translates to a string.
The first byte gives the length of the string and then you have the string. I have the following pattern that works:
I wonder if there's maybe a better way to do this? |
Beta Was this translation helpful? Give feedback.
-
Hello, yes there is a better way. Check out the standard library type: import type.magic;
std::string::SizedString<u8> string @ 0x0a; |
Beta Was this translation helpful? Give feedback.
Hello, yes there is a better way. Check out the standard library type:
std::string::SizedString
from thetype.magic
library. In this case you'd use it like this: