Re: How to LPCTSTR Convert to char *



On Wed, 06 Dec 2006 13:12:20 -0500, Joseph M. Newcomer
<newcomer@xxxxxxxxxxxx> wrote:

An LPCTSTR is a const TCHAR *, so do you mean you want to remove the const attribute, or
you really want a 'char *' data type (remember that char and char* represent an obsolete
technology that should be used only in very rare and exotic situations where you are
absolutely guarnteed because of external specs to be using 8-bit characters, and should
never be coded as a matter of course in any program).

If you really want a 'char *', that is, a pointer to an 8-bit character string, then you
have to explain why you need it and how you plan to handle the down-conversion from
Unicode characters that have no 8-bit equivalents.

There are those of us who must interface with external hardware in
which the communication interface specifies ASCII character set
messages. For us, creating char[] messages and filling specific
fields with char strings is quite essential. I was enormously taken
aback by switching to the latest Visual Studio and finding all my
strings defaulting to Unicode. So far my applications do not need
internationalization and I am working hard to separate strings used
for user interface from strings used for device communications, though
they are closely inter-related. Still, legacy code including pieces
dating back to DOS days, makes for hard work which is hard to get
somebody to pay for since it does not produce visible enhancements to
performance or add features.

.



Relevant Pages

  • Re: How to LPCTSTR Convert to char *
    ... number of people who use 'char' because they've never grown beyond their first programming ... These are the people who are getting nuked by VS2005 which defaults to Unicode apps. ... isolated to the embedded interface (rare and exotic situation imposed by external ... fields with char strings is quite essential. ...
    (microsoft.public.vc.mfc)
  • How does "write" work for ofstream?
    ... My program saves strange characters in the ofstream object valid_file, ... does is read the line, separate the fields into strings, copy those ... char cust_code; ... bool validate_writeI; ...
    (alt.comp.lang.learn.c-cpp)
  • Re: somebody dropped a (warning) bomb
    ... If one actually needs to compare alphabetic characters numerically, ... Char values are indexes in a character set. ... char strings are often signed char strings, ... you in fact don't solve initial problem of comparing ...
    (Linux-Kernel)
  • Re: sort problem
    ... AS> # Set $order{$char} to increasing values in the sequence we want ... No, i mean "characters". ... strings and the number of hash keys. ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)
  • Re: Sets and portability (was) Re: Is ISO Pascal compatible with J&W (original) Pascal ?
    ... strings, the user can control the length by the data they process; ... >> The computer world is more complex than it's ever been (eg Unicode) ... The Pascal `Char' type can be this size (unlike C, ... > Note that ansi->wide conversion is codepage sensitive. ...
    (comp.lang.pascal.misc)

Loading