K
Karl Ebener
Hi!
I am currently using a string to hold data (can be strings as well as
binary!). Now it occured to me, that the <string> might be unable to
handle Null-Bytes. Is that so?
Following question: How can I copy the binary data of a string into an
array, such as
char mtext[512] (or alike) ?
Until now I used c_str() to get a pointer to a c_str-representation of
my string and copied this with strncopy. But there I definitely lose
Null-Bytes.
I have to convert the other way, too? I just used a
string s = mtext;
for this until now.
Should I use something else for holding the data or is there a way to
copy the bytes "as they are" into the array and back?
Tnx a lot in advance.
Karl
I am currently using a string to hold data (can be strings as well as
binary!). Now it occured to me, that the <string> might be unable to
handle Null-Bytes. Is that so?
Following question: How can I copy the binary data of a string into an
array, such as
char mtext[512] (or alike) ?
Until now I used c_str() to get a pointer to a c_str-representation of
my string and copied this with strncopy. But there I definitely lose
Null-Bytes.
I have to convert the other way, too? I just used a
string s = mtext;
for this until now.
Should I use something else for holding the data or is there a way to
copy the bytes "as they are" into the array and back?
Tnx a lot in advance.
Karl