Posted By: silencer
Help with parsing block of text from file - 04/06/09 21:50
So I have a text file I need to read from. In the text file the text is formatted in the following manner.
I need to write a loop that will recognize the "[" opening bracket, bypass it, and then continue reading the strings (using the "," as a delimit character) until the next "[" opening bracket is hit, at which point the loop should terminate.
Additionally I have an int variable counting the amount of "[" opening brackets hit while parsing. I will use this counter to switch between different blocks of strings when needed.
So far I have the following:
How do I utilize an extra delimiter character to count the "[" opening brackets?
Code:
[someString1,someString2,someString3] [someStrhing4,seomStrhing5,someStrhing6]
I need to write a loop that will recognize the "[" opening bracket, bypass it, and then continue reading the strings (using the "," as a delimit character) until the next "[" opening bracket is hit, at which point the loop should terminate.
Additionally I have an int variable counting the amount of "[" opening brackets hit while parsing. I will use this counter to switch between different blocks of strings when needed.
So far I have the following:
Code:
fhandle = file_open_read (filename); // Opening file while(eof != -1){ eof = file_str_read(fhandle, test_str); str_cpy( (dialog_file.pstring)[count], test_str); //Pushing lines into array count += 1; }
How do I utilize an extra delimiter character to count the "[" opening brackets?