t*********n 发帖数: 278 | 1 I need to read a address book file. Each line is composed of street name,
city name, and extra. The problem is that the words in city name and street
name are seperated by space. I can not parse the line just by space
delimiter. I am thinking to use some special delimiter, like "|', to
seperate each field. Did C++ have some kind of building function to
automatically seperate the fields, which are broken by the delimiter. | O*******d 发帖数: 20343 | 2 The answer is no. Java has StringTokenizer. C++ has no such a thing. You
have to build it yourself. Or you may get it somewhere on the internet. | P********e 发帖数: 2610 | 3 sscan可以
I need to read a address book file. Each line is composed of street name,
city name, and extra. The problem is that the words in city name and street
name are seperated by space. I can not parse the line just by space
delimiter. I am thinking to use some special delimiter, like "|', to
seperate each field. Did C++ have some kind of building function to
automatically seperate the fields, which are broken by the delimiter.
【在 t*********n 的大作中提到】 : I need to read a address book file. Each line is composed of street name, : city name, and extra. The problem is that the words in city name and street : name are seperated by space. I can not parse the line just by space : delimiter. I am thinking to use some special delimiter, like "|', to : seperate each field. Did C++ have some kind of building function to : automatically seperate the fields, which are broken by the delimiter.
| k****f 发帖数: 3794 | 4 试试strtok
street
【在 t*********n 的大作中提到】 : I need to read a address book file. Each line is composed of street name, : city name, and extra. The problem is that the words in city name and street : name are seperated by space. I can not parse the line just by space : delimiter. I am thinking to use some special delimiter, like "|', to : seperate each field. Did C++ have some kind of building function to : automatically seperate the fields, which are broken by the delimiter.
| c*********h 发帖数: 125 | 5 try getline, its last parameter is delimiting character. | z********0 发帖数: 9013 | |
|