Re: How to convert TCHAR type to standard ISO C++ string?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Tim Roberts" <timr@xxxxxxxxx> wrote in message
news:v1ja02dh1mduqj5lpekmdr0f10mog6ihbg@xxxxxxx
"Mark Randall" <mark[__OKTHISISFAKE_]yr@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

TCHAR *is* an ISO, the difference is it changes dependant on what
_UNICODE and UNICODE defines you have.

No, it's not. It is purely a Microsoft invention, as are the
_UNICODE and UNICODE defines.

Handy, yes. Part of the ISO standard, no.

Well, Mark could perhaps have chosen a better wording, but his point is
valid. He responded to this question:

So how to convert the proprietary TCHAR type string to a
standard C++ string, so it can be used in ISO standard C/C++?

which kind of implies that TCHAR is dark magic and a program using it is
automatically not standard C++ compliant. Which is not the case of
course - while TCHAR is not specifically standardized, it is defined in
terms of ISO standard constructs.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: Window types
    ... typedef WCHAR TCHAR, * PTCHAR; ... typedef char TCHAR, * PTCHAR; ... Under a Unicode build, ... If the only text your app needs to deal with can be handled with ASCII ...
    (microsoft.public.vc.language)
  • Re: TCHAR and buffer overflows
    ... > This would be a problem if you hadn't defined UNICODE in your build. ... > Check your factory headers for TCHAR defs and such, ... checked whether the MSVCRT memcpyimplementation actually detects overlapping ... Or good tools, lousy user, lousy work. ...
    (comp.security.misc)
  • Re: TCHAR and buffer overflows
    ... > This would be a problem if you hadn't defined UNICODE in your build. ... > Check your factory headers for TCHAR defs and such, ... checked whether the MSVCRT memcpyimplementation actually detects overlapping ... Or good tools, lousy user, lousy work. ...
    (comp.os.ms-windows.nt.admin.security)
  • Re: Ada, Gnat and Unicode
    ... > that same ISO. ... Unicode is that the BMP are ... Unicode have at least two potential representations. ... representations of characters in the BMP through composition. ...
    (comp.lang.ada)
  • Re: VC2005 Pro: IDE (Compiler ?) cant find Stdafx.h
    ... For new code I would obviously use UNICODE but for existing stuff ... > Use Multi-Byte Character Set ... > If you use TCHAR etc., and want your code to run on another platform, then ... > typedef char TCHAR; ...
    (microsoft.public.vc.language)