[All]
Using AnsiStrings and char *
By: Mat Duafala
Abstract: Using AnsiString with Win API
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 *.
Connect with Us