Q:

Inserting numbers from file into vector>

I would like to insert each row into vector.
My file looks like this:

The problem is to use multiple delimiters with getline. 
My code looks like this :
vector<int>czytajplik()
{
string line;
vector<string> text;
ifstream mojplik;
vector<vector<int>> zajecia;

mojplik.open("dane.txt");
if (mojplik.is_open())
{
    while (getline(mojplik, line))
    {

        while (getline(mojplik, line, ' '))
        {
            text.push_back(line);
        }
    }
    mojplik.close();
}

else cout << "Unable to open file" << endl;

vector<int> textnumery;
for (int i = 0; i <text.size(); i++)
{
    int num = atoi(text.at(i).c_str());
    textnumery.push_back(num);
}
return textnumery;

}

A:

I'm going to assume that you have data that looks something like

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

and want to have a 2d vector equal to 
vector<vector<int>> result = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 } };

Then you want something like
vector<vector<int>> zajecia;
ifstream mojplik("dane.txt");
if (mojplik.is_open())
{
    for (string line; getline(mojplik, line); )
    {
        stringstream numbers_stream(line);
        vector<int> numbers;
        for (int number; numbers_stream >> number; )
        {
            numbers.push_back(number);
        }
        zajecia.push_back(numbers);
    }
    mojplik.close();
}

