RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
AnsiString::c_str Method

Returns the System::AnsiString::AnsiString converted to null-terminated character array.

Pascal
function c_str: char*;
C++
__fastcall char* c_str() const;

c_System::AnsiString::c_str returns a pointer a null-terminated character array containing the same characters as the System::AnsiString::AnsiString. If the System::AnsiString::AnsiString is unassigned, c_System::AnsiString::c_str returns an empty System::AnsiString::c_string (“”). 

Usually, the value returned by c_System::AnsiString::c_str points to the internal character array referenced by the data property. This pointer is valid until the System::AnsiString::c_string is next modified (for example when the SetLength method is called or the System::AnsiString::AnsiString goes out of scope). However, if the internal array is NULL, c_System::AnsiString::c_str returns a pointer to a System::AnsiString::c_string literal.  

The c_System::AnsiString::c_str method is intended primarily for reading the value of the System::AnsiString::AnsiString. To modify the System::AnsiString::c_string’s value, use the [] operator or System::AnsiString::AnsiString methods such as Insert and Delete

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!