The STRCHAR type |
![]() |
Str Library uses extensively a new datatype called STRCHAR. It is an abstraction for a character data type that may be either Unicode or ANSI, depending on the build mode of the library.
The table below summarizes the various character and string types in standard C++ (typical for Linux applications), Windows and Str Library. Please note that you can use the equivalent types interchangeably, without typecasting. For example, if you are writing a Windows application and have a LPCTSTR value, you can pass it directly where Str expects const STRCHAR* without typecasting.
| Standard C++ | Windows specific | Str Library type | Description | |||
| char | CHAR | STRACHAR | Character (always ANSI) | |||
| wchar_t | WCHAR | STRWCHAR | Character (always Unicode) | |||
| tchar | TCHAR | STRCHAR | Character | |||
| char* | LPSTR | STRACHAR* | Modifiable ANSI string | |||
| const char* | LPCSTR | const STRACHAR* | Const ANSI string | |||
| wchar_t* | LPWSTR | STRWCHAR* | Modifiable Unicode string | |||
| const wchar_t* | LPCWSTR | const STRWCHAR* | Const Unicode string | |||
| tchar* | LPTSTR | STRCHAR* | Modifiable string | |||
| const tchar* | LPCTSTR | const STRCHAR* | Const string |
Most code and operations in Str Library deal with the Str class which represents a string; however, the library also implements the helper Char class which represents a single character. (Note: for Borland C++ Builder users, this class is called StrChar)
See also: ANSI / Unicode mode, Char class, Unicode