Big Reading problem

Hello, I have a txt file
Miami str. 22-6 107.9
Lambo str. 29-657 196.89
Ferrari str. 36-14 168.2

for example Miami str. (Street name (string)) 22-6(adress (string)) 107.9(area (double))
And now I need to read with geline but how?
1
2
3
4
5
while(fd.eof()){
getline(fd, name);
fd >> adress;

}
Last edited on
One problem here is the street name consists of two words. But in the real world, a street name could have more than two words, making it difficult to recognise, unless it is separated from the next value by a specific delimiter, such as the tab character '\t'.


This may be of some general use, though it doesn't directly solve the problem: http://www.cplusplus.com/forum/beginner/114313/#msg624667
Hmm, you are right. But how i need to read this file?
Well, you could perhaps assume that the street name is always two words. But the tab delimiter is safer. Alternatively, read as many words as you can from the line, and work from the right-hand side, last word becomes area etc.
Topic archived. No new replies allowed.