10

I'm having a problem with extracting b2vec2 coordinates from a CCString these are from cocos2dx and box2d.

I have tried using strtk but i could not get it to work

Any help would be great.

Thanks

The Layout of the string is "x,y x,y x,y" i want to put the x and y's into an array of b2vec2

user1523362
  • 119
  • 9

1 Answers1

1
string s = "12,4 4,5 6,3";

istringstream is(s);
while (is.good())
{
    int x, y;
    char comma;
    is >> x >> comma >> y;

    cout << x << ", " << y << endl;
}
Andrew
  • 24,218
  • 13
  • 61
  • 90