Re: How to LPCTSTR Convert to char *



I agree with Ajay... I would just change it to an ANSI project by turning
Unicode off in the Project Properties. That will be the easiest solution
since you have no internationalization needs.

Tom

"r norman" <r_s_norman@xxxxxxxxxxxx> wrote in message
news:4e4en21dq26inbns39jaeq5ngk7ekvborc@xxxxxxxxxx
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)
  • Re: How to LPCTSTR Convert to char *
    ... One of the things I learned is that "no internationalization" is a transient state, ... Unicode support, ... which the communication interface specifies ASCII character set ... fields with char strings is quite essential. ...
    (microsoft.public.vc.mfc)
  • Re: How to check variables for uniqueness ?
    ... characters is the sequence SS. ... is simply capitalizing strings. ... The fact that case mapping in English /is/ simple is neither here not ... That is a fair criticism of the Unicode position. ...
    (comp.lang.java.programmer)
  • Re: Dangerous behavior of CString
    ... If I'm reading a data file or serial port or something, if the raw data are multibyte but the compilation is Unicode or vice-versa, then sometimes the converting constructors in CString are convenient. ... I did not actually write code like this; in fact I was pretty careful always to use the _T macro with any literal strings. ... But it does the conversion using the current 8-bit code page, which is not what I want. ...
    (microsoft.public.vc.mfc)
  • Re: Help please
    ... i would like to provide "CSimString" class code because the settings ... I agree with Tom that first step is project clean and rebuild all. ... with a Unicode string, ... Consider that VS2005 strings are Unicode by default, ...
    (microsoft.public.vc.mfc)