Hello all, hopefully a quick question for you guys.
I'm trying to take a std::string object and be able to assign individual elements in it with arbitrary characters. Meaning, I want to be able to do something like:
How can I allocate memory to my std::string object without assigning specific values to it? Is it possible to do something like this?Code:string pString; for (int x = 0; x < 10; x++) { pString[x] = x; }
Will that assign enough memory for 10 characters? (9 plus null terminator I mean).Code:string pString(10);



LinkBack URL
About LinkBacks


