getline - red new sets of data problem.

Hello there. I'm currently solving problem of parsing txt file. That file looks like this:
Voltage 5
//ID Type Vn V Theta[rad]
0 1 1 1 0
1 0 1 1 0
2 0 1 0 1
3 0 1 1 1
4 0 1 0 0

//some lines of comments
//additional text

Lines 3
//description of values
0 3 4

So, my problem is that I could read data only for Voltage, and my program stops the read next lines of data. I would like to ignore next 4 rows after Voltage, and continue to read data for Lines. Any help would be higly appreciate.
This is my code...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 stringstream ss;
  ifstream file;  
  string line,name;
  int num;
  ifstream values ( "values.txt", std::ios::in);  //opening file
  while(getline(values,line)) // Reads lines into line 
  {		 
	ss.str(line);  // Use s as source of input.
	ss>>name>>num;
	getline(values,line);
	if(name == "Voltage")
	  {
		int _id=0;
		int _type=0; 
		int _Vn;
		float _V,_Theta;
		for (int i=0;i<num;i++)
		  {
		        getline(values, line);
			ss.clear();
			ss.str(line);
			if(line.substr(0,2) !="//")
			{
			ss >> _id >>_type>>_Vn>>_V>>_Theta;
			}
		  }
	  }
       else if(name == "Lines")
	{
		cout<<"I found the lines data !";
	}


Edit: anybody has idea ?
Last edited on
Topic archived. No new replies allowed.