Advertisement

string?

Started by July 08, 2001 07:45 AM
0 comments, last by sense 23 years, 7 months ago
Hi all How do i convert the Edit->Text (Borl C++ B) into a string or how can i work with it as a string? I didn''t get it
In BCB you have two kinds of string. Normal null terminated C strings and something called AnsiString whitch is an object holding normal string plus some functions.
To convert from AnsiString to normal string use AnsiString::c_str() function.

char *str;
AnsiString s;

str=s.c_str();

if you want to convert other way, try casting

s = AnsiString(str);

or try initialising

AnsiString s = new AnsiString(str);

Edit1->Text is an AnsiString type so to get normal string use
Edit!->Text.c_str()

Hope it helps.

K.

This topic is closed to new replies.

Advertisement