CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE:BCB3 Weirdness. You gotta see it!



I had a weird problem that was driving me up the wall.  I had function that counted the words in a TrichEdit. It worked fine in version 1, but in BCB3 it would work 3 times then stop.

TrichEdit *TRE;
Int ctr = 1;
Int Length = TRE->GetTextLen();  <--- this is where it would crash. Invalid Address
While (ctr < Length)
{
	if (TRE->Text[ctr] == ' ')	
...

I changed the code to by passing in the Text and it got even weirder
AnsiString *Text;
Int ctr = 1;
Int Length = Text->Length();   <----this worked fine but 
While (ctr < Length)
{
	if (Text[ctr] == ' ')   <------after 3 times this would crash. Invalid Addres

I inserted a blank line before "if" and the problem went away

This kind of makes it difficult to use Builder for developing software


W Komornicki's Home Page | Main Index | Thread Index