Convert string to ANSI / Unicode

Web Site  Methods

 
Str::GetStringA
Str::GetStringW
 

STRACHAR* GetStringA () const
STRWCHAR* GetStringW () const

These two methods are available only in platforms that support Unicode.  They can be called regardless of whether Str Library is compiled in ANSI or Unicode mode.

Unlike the simple GetString (or its equivalent const STRCHAR* typecast), GetStringA / GetStringW will allocate a dynamic buffer to hold a copy of the Str object data, then return the null-terminated copy there.  If there is a need to perform conversion - e.g. calling GetStringW in an ANSI application -- the string will be converted.

The returned value is a buffer that can be freely modified, but the caller is responsible to release it with the static Str::OS_free method like this:

   Str::OS_free(mem)

Otherwise, memory leaks will occur.

 

See also: Basic operations