Need Advice on How on reading and breaking up of text file

Dear All,

I need to an advice on the following. Which method can i use to read the following format of text file?

I have tried getline and also using extraction operator but I can't seem to seperated them out. Can any one kind enough to tell me the logic of reading this text file and which method that i need to focus so i that i can steamline my effort in solving this. Thank you in advance.


int int
stringFName StringSName stringIC char int
stringCName stringNumber int char
stringCName stringNumber int char

stringFName StringSName stringIC char int
stringCName stringNumber int char
stringCName stringNumber int char

stringFName StringSName stringIC char int
stringCName stringNumber int char
stringCName stringNumber int char
Hi All,

I have tried doing a nested loop to loop the folllowing but there is something wrong. Can any one advice on the looping.

stringFName StringSName stringIC char int
stringCName stringNumber int char
stringCName stringNumber int char

1
2
3
4
5
6
7
8
9
10
11
12
13
14
        fin >> temp >> temp2;
        cout << temp << " " << temp2 << endl;

     //for (int i= 1; i < temp; i++)   //the issue


        {
            fin >> temp3 >> temp4 >>  temp5 >> temp6 >> temp7;
            cout << temp3 << temp4 << temp5 << temp6 << temp7 << endl;

            for(int j= 1; j < temp7; j++)
            {
                fin >> temp8 >> temp9 >>  temp10 >> temp11;
                cout << temp8 << temp9 << temp10 << temp11 << endl;
stringFName StringSName stringIC char int
stringCName stringNumber int char
stringCName stringNumber int char
It's hard to read that, can you provide some real values?

1
2
fin >> temp3 >> temp4 >>  temp5 >> temp6 >> temp7;
cout << temp3 << temp4 << temp5 << temp6 << temp7 << endl;
You have some awful variable names there
Topic archived. No new replies allowed.