Reading File

I want to read a txt file line by line that looks like this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
header {
  version { "0.95" }
  build { "2007.04.02" }
}
environment {
  grid { 1 10 50 50 }
  framerate { 24 }
}
object { "object01"
  cube {
    name { "cube01" }
    base {
      origin { (10 -5 6) }
    }
    material { " -- default --" }
    scale { 15 15 15 }
    divisions { 1 1 1 }
  }
}


I want it to skip over ever line until it gets to "cube {", and then skip over every line until it gets to "origin { (10 -5 6) }", and then "scale { 15 15 15 }". Then I want to store those numbers in variables.

What I've run into, is how do I compare part of a string to another, and how do I get those numbers.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    string tester="  cube {";
    while(1)
        {
        getline (fileIn,line);
        if (line == tester)
            {
            cout << "Found cube line.\n";
            //Do stuff.
            }
        if (fileIn.eof())
            {
            goto end;
            }
        }


This works to find the " cube {" line, but how do I find the "origin { (10 -5 6) }" line. I can't do it the same way because the numbers will be different every time.
Last edited on
Thanks!
Topic archived. No new replies allowed.