Hi there,
ok, im fairly new to c++ and have been trying to figure this out for ages:
I have a text file i want to read in that contains lines and lines of lat long points;
N50 42.22 W002 55.33
N50 42.22 W002 55.33
N50 42.22 W002 55.33
i want to seperate each column and data type and out that into an array (colunms are seperated by a tab "\t"), so
String s[] = {N,N,N}
int x[] = {50,50,50}
double y[] = {42.22,42.22,42.22}
etc
So far i can read in each line:
string line;
ifstream myfile ("lat_longs.txt");
myfile.is_open();
while ( myfile.good() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
But i don't know how to loop over each character, check its data type and store it in the appropriate array? hit a "\n" and do it all again until eof.
I feel like i'm barking up the wrong tree with the above and that i'm missing something, is there a function that already does this?
Anyone? HELP!
Many Thanks
Alex