I have a problem. I am building a program that needs to take a string
like "\x20\x21" or something (just the fact that it's hex is
significant) and turn it into a string that has those sequences turned
into 'bytes' or whatever. So, In the previous example, it would take
the string "\x20\x21" and turn it into " !". The source from which I
am getting this string does not provide any way to do this, so I need
the source to pass a C++ dll a string, C++ works on it, and returns
the proper string. The format in which it must be is not \xblah, it
can just be numbers separated by a space, or whatever would be
easiest, like "20 21" etc.
Thanks for any help.
Thanks, I'll try it out right away.
I honestly don't understand what the problem is.
std::string space_bang_ascii("\x20\x21");
Perhaps you need to specify it a bit clearer... Try pseudocode.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
I think he meant that he is reading the string in from somewhere else
and it is known to consist of sequences like "\\x20\\x21", (doubled '\'
to clarify that the string itself contains a '\'), and he wants to
parse the string.
--
Dan G
Yeah, actually I am getting them from Lua which does not support
putting hex characters or whatever you call them in strings, so I
would make a DLL to load from Lua that would pass "40 39 20" for
example (since doing "\x40\x39\x20" would do absolutely nothing, and
would probably be an unknown escape sequence), and then the DLL would
return whatever that would equal if you had done "\x40\x39\x20" in C++.
Any idea how I could make it into a 'string' that could contain null
characters?