TCHAR implementation for UNIX?
Posted on 1998-08-29
I need to get a Unix-compatible implementation of TCHAR. Microsoft Visual C++ provides a full TCHAR generic character implementatation. TCHAR datatypes are conditionally typedef'ed to wchar_t or char, depending on the setting of the -DUNICODE compiler directive. It deals with the following:
TCHAR -> wchar_t or char
LPTSTR -> LPWSTR or LPSTR
_tcslen -> wcslen or strlen
_T"abc" -> Unicode string "abc" or ANSI string "abc"
tprintf -> wprintf or printf
Is there a UNIX implementation of TCHAR? I thought it was part of the ANSI standard, and not just a Microsoft idea.
For example, I'd like to make this very simple program 100% portable between NT and UNIX, but retain it's ability to be compiled as implementing Unicode strings or non-Unicode strings based on the #defines at the top. This needs to be generic across multiple UNIX implementations (let's say Solaris and HP-UX). Is there a standard UNIX header that does this for me? Is there a 3rd party library that does this?
ptr = test;
_ftprintf(stdout, _T("Text is: %s and length is %d\n"),test,n);