System.UnicodeString.t_str
C++
WideChar* t_str _DEPRECATED_ATTRIBUTE0 () const { return (Data)? Data: const_cast<WideChar*>(_D(""));}
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | ustring.h | System | UnicodeString |
Description
Returns UnicodeString data as a const w_char*. This function is deprecated. Please use System.UnicodeString.c_str instead.
The UnicodeString.t_str() function now always returns wchar_t*
regardless of the current _TCHAR Mapping.
Note: This change does not affect you if you use _TCHAR mapping =
wchar_t
.
In recent C++Builder releases in which the default string type is UnicodeString, t_str()
returned either:
const char*
(if _TCHAR was mapped tochar
)const wchar_t*
(if _TCHAR was mapped towchar_t
)
If _TCHAR mapping is set to char
, you cannot assign the result of the t_str()
function to something that does not support wchar_t
(a compiler error is emitted in this case).
Example
In order to use char
values, you need to convert the data as follows:
Before XE: mystr.t_str()
Now: AnsiString(mystr).c_str()