I have a bunch of ASCII based text files that are used as input files into various computer programs and I need to convert them to a different format. Each input file starts with a 4 digit number and is then either followed by further input data or comment lines if the first four digit number begins with a 0 (number zero). I am developing a C++ based file convertor and I would like it to read in the four digit number and if that number is a zero read in the comment lines that follow it. An example is provided below. C++ can easily read in the numbers as an array or by using std::vector; however reading in the character string gets to be much more complex. First of all if each comment line had the same number of words, I could treat each string as if it were filling its own line within a fixed column, but since each comment line has a different number of words, then the number of columns to be read in at each line would be different. Is there a simple way to read in the comment lines where C++ will not see the space between each word as the end of one column of data and the beginning of another? Generic numbers and data are used in the file example below, but hopefully you can see that the comment lines starting with the number 0 have a different number of words following them, making it impossible to read the file in as a serious of data columns.
0001 Input File Name 0001 - Description of input file goes here 0001 - PROGRAM name that works on this data 0000 ========================================== 0001 List of references used in the development of this input file 0001  Ref. 1 0001  Ref. 2 0001  Ref. 3 1100 Input line 1: CBRD 1-0220 1101 Core Length (mm): 8.189 1102 Core diameter (mm): 37.81