I have a textfile in this form:
1 1
2 2
3 3
#
4 3
5 1
Now I want to read this textfile and count two variables num1 andnum2. num1 counts the number of all character´s until #and num2 counts the number of all character´s after #.
My code so far:
Graph::Graph(string s) // s is the filename
{
    ifstream tgf(s);
    string line;
    // num1 and num2 are two private member (type int) of class Graph 
    num1 = 0; 
    num2 = 0;
    if(tgf.is_open())
    {
        while(getline(tgf, line, '#')) // this should read tgf until '#'
        {
            num1++;
        }
    } else
    {
        cout << "Can´t open textfile!" << endl;
    }
}
I have no idea how to write the code for my problem.
 
     
    