Reading only certain values from text file

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
#include <iostream>
#include <fstream>
#include<sstream>
#include <string>
using namespace std;

int main () {
  string line,Rotationmatrix;
  ifstream myfile ("out.txt");
  if (myfile.is_open())
  {
    while ( myfile.good() )
    {
      getline (myfile,line);
std::string part;
  std::stringstream ss(line);
  std::getline(ss, Rotationmatrix, ',');

  std::getline(ss, part, ',');

  std::getline(ss, part, ',');

      cout << line << endl;
    }
    myfile.close();
  }

  else cout << "Unable to open file";

  return 0;
}


Here is the code i need to read only certain values from text file just like only Rotational matrix from the file.

http://s10.postimg.org/hi44mry6x/image.jpg
Topic archived. No new replies allowed.