>I am using string.h, but I'm not using cstrings. C++ strings are much easier to manipulate and finally parse
No, you're using <string>, not <string.h>. The two are completely different.
Code:
#include <iostream>
#include <vector>
#include <string>
int main()
{
std::string s = "hello nice world";
std::vector<std::string> vec;
int start = 0, end = 0;
while ( end != std::string::npos ) {
end = s.find ( ' ', start );
vec.push_back ( s.substr ( start, end - start ) );
start = end + 1;
}
for ( int i = 0; i < vec.size(); i++ ) {
std::cout<< vec[i] <<std::endl;
}
}
>will hello.size() return the number of characters in the whole string?
Yes.
-Prelude