okaypi
Programmer
- Feb 15, 2011
- 1
Hi
i am using borland C++ 6, my question regarding the following code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char* S = Edit1->Text.c_str();
Edit2->Text = strlen(S); //gives erroneous result
AnsiString st = Edit1->Text;
Edit3->Text = st.Length(); //gives correct results
}
if the text in Edit1 is more than 3 Chars then the length of the string written to
Edit2 and Edit3 will be correct.
but if the Text in Edit1 <= 3 then number 1 will be written in Edit2 and the coorect
number in Edit3
why is this behaviour regarding the results in Edit2 when the string lenght <= 3 characters ? thanks
i am using borland C++ 6, my question regarding the following code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char* S = Edit1->Text.c_str();
Edit2->Text = strlen(S); //gives erroneous result
AnsiString st = Edit1->Text;
Edit3->Text = st.Length(); //gives correct results
}
if the text in Edit1 is more than 3 Chars then the length of the string written to
Edit2 and Edit3 will be correct.
but if the Text in Edit1 <= 3 then number 1 will be written in Edit2 and the coorect
number in Edit3
why is this behaviour regarding the results in Edit2 when the string lenght <= 3 characters ? thanks