I have this input: (50.1003781N, 14.3925125E)which is stored in const string & input. What I'm trying to do is extract the brackets, get the number representing the GPS coordination - 50.1003781, save N and do the same for the second coordinate.
So here is my code:
istringstream iStream(input);
char brackets[2];
char types[2];
char delim;
double degrees[2];
iStream >> brackets[0] >> degrees[0] >> types[0] >> delim;
iStream >> degrees[1] >> types[1] >> brackets[1];
But it does not work on loading degrees[1], it loads zero, and tellg()says -1, probably due to a space after the decimal point. The syntax line should be like this:
cout << brackets[0];
cout << degrees[0];
cout << types[0];
cout << delim;
cout << degrees[1];
cout << types[1];
cout << brackets[1];
I tried skipws and noskipws, but with no effect. Can anyone help please? Many thanks.
source
share