Web Hosting Talk







View Full Version : Exploding a string in c++, need help.


azizny
06-19-2008, 12:15 PM
I am trying to explode a string in c++ using string operations:


// read in user input
std::cout << "Please enter operation:\n";
std::cin >> operation;

while(operation.empty()){
string::size_type loc = operation.find( " ", 0);
cout << "Found space at " << loc << endl;
operation.erase(operation.at(loc).size());
}



I have looked many places, and size should be an operation for strings, however, I keep getting this error:

error C2039: 'size' : is not a member of 'System::SByte'

I also tried length (which should be the same thing), similar error.

Thanks for any help,

Peace,

aditya2071990
06-23-2008, 02:14 PM
Just try to post this question in a c++ specialist forum, I'm sure you'll get a good answer...good luck!