System.UnicodeString.c_str

From RAD Studio API Documentation
Jump to: navigation, search


C++

WideChar* c_str() const   { return (Data)? Data: const_cast<WideChar*>(L"");}

Properties

Type Visibility Source Unit Parent
function public ustring.h System UnicodeString

Description

Returns a pointer to the underlying string data as const wchar_t*.

c_str returns a wchar_t pointer to the location in memory where the value of the UnicodeString object is stored. If the UnicodeString is unassigned, c_str returns a wchar_t pointer to the empty string (“”).

Usually, the value returned by c_str points to the internal character array referenced by the data function. This pointer is valid until the UnicodeString is next modified (for example, when the SetLength method is called or the UnicodeString goes out of scope). However, if the internal array is NULL, c_str returns a wchar_t pointer to the empty string (“”).

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


See Also