I created a simple BCB project that took a Info.ini file and broke out the lines in question. First, I created the following Info.ini file:<br><font color=blue>###Dummie Text###<br>;Not interesting<br><br>@Owner="Me"<br>@Input="Get this line"</font><br><br> Next, I created a simple form with one memo box and a button. The following code I put in the buttonclick method. You could put it anywhere you need to. You can also eliminate some/all of the Memo1 output lines. I put these in to follow the flow of the program. One final note, I did not put a lot of error processing in, I left that up to you. Also, you may need to rearrainge where the variables are created to change the scope if you need to. For that matter, you may need to rearrainge everything.

<br><font color=blue><br>Memo1->Lines->Add("Opening file for reading..."

;<br><br>ifstream IFile; // stream set up<br>IFile.open("Info.ini"

; // open for read<br><br>if (!IFile)<br>{<br> // Something went wrong<br> Memo1->Lines->Add("Could not open Info.ini"

;<br>}<br>else<br>{<br> // Everything OK, get data<br> IFile.unsetf(ios::skipws);// don't skip white space, probably not necessary with getline<br><br> string ImpLine; // import line<br><br> // NOTE: If using BCB 5 or C++ 5.5, getline has a bug. See Borland Article ID #21145<br> while (getline(IFile, ImpLine, '\n'))<br> {<br> // Do Something<br><br> if (ImpLine.empty())<br> {<br> // Nothing to import<br> Memo1->Lines->Add("Nothing to import from Info.ini"

;<br> }<br> else<br> {<br> // Let's bite the bullet and translate the C++ string to Borland's Pascal string<br> // This way we can use the Pascal string easier for Memo1<br> AnsiString WorkString = ImpLine.c_str();<br> Memo1->Lines->Add(WorkString);<br><br> char CheckDigit = WorkString[1]; // We only want lines with @<br> if (CheckDigit == '@')<br> {<br> //Process here<br> Memo1->Lines->Add("Got a line"

;<br><br> // Good boy (girl). Now lets parse the line<br> int StrLen = WorkString.Length(); // We'll need the string length<br><br> // Let's get the part of the line from the @ to the =<br> // First, let's find the = position<br> int EqlSignPos = WorkString.Pos('=');<br><br> if (EqlSignPos > 0)<br> {<br> // Found equal sign;<br> // Get the first part of the string, skipping the @ and = signs<br> AnsiString FirstPart = WorkString.SubString(2, EqlSignPos-2);<br> Memo1->Lines->Add(FirstPart);<br><br> // Now lets break about the string again, skipping the " sign<br> AnsiString SecondPart = WorkString.SubString(EqlSignPos+1, StrLen);<br> Memo1->Lines->Add(SecondPart);<br><br> AnsiString Who; // the who belongs to the first part<br> // We could assume that the = sign is immediantly behind the =<br> // but let's not make this assumption<br> int FirstQuotePos = SecondPart.Pos('"');<br> if (FirstQuotePos == 0)<br> {<br> Who = SecondPart; // no quotes<br> }<br> else<br> {<br> // Parse string some more<br> AnsiString ThirdPart = SecondPart.SubString(FirstQuotePos+1, SecondPart.Length());<br> Memo1->Lines->Add(ThirdPart);<br><br> // Now, we again could assume that the last " mark is at the end<br> // but what if we would like to add a comment after it<br> int SecondQuotePos = ThirdPart.Pos('"');<br> if (SecondQuotePos == 0)<br> {<br> // Then we have it<br> Who = ThirdPart;<br> }<br> else<br> {<br> // Final parsing<br> Who = ThirdPart.SubString(1,SecondQuotePos-1);<br> }<br><br> Memo1->Lines->Add(Who);<br> }<br> }<br> }<br> }<br> }<br>}<br><br>Memo1->Lines->Add("Closing file..."

;<br>IFile.close();<br><br>Memo1->Lines->Add("Done!"

;<br></font> <p>James P. Cottingham<br><a href=mailto: > </a><br><a href=
Veneer Co., Inc.</a><br>All opinions are mine alone and do not necessarily reflect those of my employer.