I'm having a problem parsing information stored in the buffer after a getline command. I have a file with data in the format: 1310 76102 C 5 27 2011 6 26 2011 5 R R 8.00 20.00 F R 8.00 25.00 150 165 I would separate everything using white space as a delimiter, but the information isn't always the same. i.e. I can't say after so many whitespaces, the next piece of information will be a character or a float.....

This program is to store information about local theaters,shows and show times, costs,etc... so while the given information is always in the same format, sometimes a certain show will have more show times during the week than others and this reflects in the data file.

Here are two examples of given data, the number of shows/week is actually given so this might help in parsing the data, this number is green and the rest of the specific showing info is in red;

Show 1 1310 76102 C 5 27 2011 6 26 2011 5 R R 8.00 20.00 F R 8.00 25.00 A M 3.00 15.00 A R 8.00 25.00 S M 3.00 15.00 150 165 Alice Wonder Show 2 2108 76010 F 7 1 2011 7 10 2011 4 F R 7.30 10.00 A M 2.00 8.00 A R 7.30 10.00 S M 2.00 8.00 200 120 The Hobbit As you can see, the first show has more show times than the second and it is this fact that is throwing me off on how to parse each line appropriately.

If you have a question please let me know as I am not quite sure how to make this post extremely clear seeing as there is a lot of information needed in order to understand how the program works as a whole.

You probably have to parse the line in stages. When you get to the times, keep parsing until the format changes. Looks like times format is char char time time , so when the char char isn't there anymore, switch to the next format.

This article has been dead for over six months. Start a new discussion instead.