Главная страница | назад





Article #21570: Using AnsiStrings and char *

Question:
I am using a VCL component that has a property that is of type AnsiString. However, if I try to make a Windows API call, it says that I can't cast it to a char *. How can I use the property as a parameter?
Answer:
You can simply call the c_str method and it will convert the AnsiString to a char *. Example: Edit1->Text.c_str(); //the text from an Edit box is converted to a char *.

Last Modified: 04-APR-00