#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string s = "whatever\nyou want\nto have";
    std::vector<std::string> vec;

    std::size_t pos;
    while( (pos = s.find('\n')) != std::string::npos )
    {
        vec.push_back( s.substr(0,pos) );
        s = s.substr(pos+1);
    }
    vec.push_back(s);
    
    // print out
    for(pos = 0; pos < vec.size(); ++pos)
    {
        std::cout << "vec[" << pos << "] = \"" << vec[pos] << "\"" << std::endl;
    }
}