Is it possible?
I've tried a few things, but no cigar.
Thanks guys/gals!
Is it possible?
I've tried a few things, but no cigar.
Thanks guys/gals!
OS: Windows XP Home Edition SP3, Windows 7 Ultimate Beta Build 7000
LANGUAGES: C++, VB6
SKILL: Novice/Intermediate
Maybe with c_str() ?
I hate real numbers.
Note that c_str() only returns const char*, not char*, so you cannot modify the string.
There's no easy way to create a char array from a std::string. You can blame the C++ standards committee for that.
But I believe the following works:
std::string mystr = "My string";
std::vector<char> v(mystr.begin(), mystr.end());
Though I may be wrong.
Jeez, that was unexpected.
Thanks a heap guys, that was extremely helpful.
OS: Windows XP Home Edition SP3, Windows 7 Ultimate Beta Build 7000
LANGUAGES: C++, VB6
SKILL: Novice/Intermediate
There's usually no need to convert a string to a char[]. Are you sure you really need to do that?
Yep.
100% sure.
OS: Windows XP Home Edition SP3, Windows 7 Ultimate Beta Build 7000
LANGUAGES: C++, VB6
SKILL: Novice/Intermediate
>> It's really a horrible workaround for functionality that should be there in the first place IMHO.
I guess you're talking about making a GetBuffer style function available for string? I actually wouldn't be surprised if that was available in a future technical report, but I don't think it's that big of a deal to do without.
>> Yep. 100% sure.
I honestly don't believe you 100% but it's not a big deal and you can do whatever you want with your program.