fundamental for CHAR, Tchar._wchar

windows ce


  • 1. POOM extensions under Magneto
    > I have a question! if any other developers have run into trouble with > their > POOM extensions under Magneto?? > Maybe Microsoft has published a new specification. Is there anybody know, > please tell me! > > Thanks in advance!
  • 2. How can i change the menubar height
    I change the menu fonts through regedit, but the menu bar is too small to fit the text. So I want to change the height of the menu bar, how can i do this. Thanks!
  • 3. Windows CE 3 + Handwrite recognition example
    Hi, I need to develop a new virtual keyboard, that can take input from handwritten character also. I need a little square in the SIP where the user can write a character with the pen, then invoke the ready made microsoft handwrite recognition engine. I need to know how to open a rectangle for the user to write the character, and how to interoperate with the handwrite recognition engine. Somebody have example on how to do that? Even a snippet from an application that uses the built-in handwrite recognition would be a great help! Thanks in advance, Luca.
  • 4. ActiveX problem
    Help me out.. The control developed using eVC++ 4.0 ATL Composite is not visible in Pocket IE 2003. Even after implementing IObjectSafety thanks in advance..

fundamental for CHAR, Tchar._wchar

Postby Jim » Thu, 05 Feb 2004 17:32:55 GMT

Hi again,

I've been using char* for character string. For certain Methods we've been
converting those char* to tchar * cos those methods were taking parameter as
_wchar or tchar. I generaly used wcstombs() method to do so. Can some one
thro the light on the basics of char , tchar and _wchar and unicode stuff.


Re: fundamental for CHAR, Tchar._wchar

Postby Andrey Yatsyk » Thu, 05 Feb 2004 22:11:53 GMT

Look at this article: "Strings on a Pocket PC, Unicode and ANSI"

Andrey Yatsyk


Re: fundamental for CHAR, Tchar._wchar

Postby r_z_aret » Fri, 06 Feb 2004 00:23:56 GMT

On Wed, 4 Feb 2004 16:11:53 +0300, "Andrey Yatsyk"

Great article!

Given how strongly I usually recommend TCHAR, folks may be shocked by
the following. But a recent exchange in another thread has affected
Explicitly using char or WCHAR _is_ appropriate sometimes. In
particular, anyone planning to read and/or write text files needs to
decide whether to use ASCII, UNICODE, or TCHAR text in the files, and
then how to store the text internally.
1) ASCII in file _and_ internally. Simplifies file i/o. But requires
constant vigilance (I _think_ the compiler will catch all mistakes,
but wouldn't want to rely on it) to explictly use functions that take
char arguments (or related)
2) UNICODE in file _and_ internally. If you want other apps to share
your files, you need to add a BOM to output files and deal with BOM in
input files (use google to look up BOM UNICODE for more info). Also
requires constant vigilance with regard to functions
3) ASCII in file, TCHAR internally (my choice). Means translating on
way in and out, if UNICODE is defined. Means using TCHAR and relatives
internally. Otherwise, using "normal" functions, so no particular

To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118

Similar Threads:


I am trying to use a function that accepts WCHAR* like:

1) err.ErrorMessage() returns TCHAR* and so I am getting the following
error: cannot convert parameter 1 from 'const TCHAR *' to 'WCHAR *'.

2) Also, Is there an easy way to concatenate WCHAR type strings to use
fn_name like:
fn_name ("Error: " + err.ErrorMessage());

3) Finally, I how do I do something like: fn_name("Error Msg: %d",
intCount); ??

Any help is greatly appreciated. Thanks in advance.

2.howto converting WCHAR* to UTF-8 char array ?


I have the task to convert some _UNICODE / wchar_t / WCHAR strings
into UTF-8 coded byte arrays and vice versa.

The WCHAR stuff is for or from API Calls (think of CreateFile()), the
UTF-8 will go over a serial line onto a Host which does not understand
Windows 16bit WCHAR types, but UTF-8.

Is there an API or C Runtime function ?
Or somewhat Open Source ?

(I am using eVC++4)

Mai Kee

Hamster beisst sich durch ...

3.wchar and char and CString

If UNICODE *is* defined (as is always the case with CE), what happens if I

CString s;
char c = 'x';

s += x;

Now, does s hold 'x' in ascii or unicode form? (is it converted?)
CString internals are wchar based when unicode is defined. So I'm wondering
what exately happens.

I wish to append a space to s, and don't know if I should append it as char
or wchar or whether it matters.



Use one of these
Win32 API : MultiByteToWideChar
C RTL : mbtowc or mbstowcs

Win32 gives you a bit more of flexibility.

"Przemo Drochomirecki" < XXXX@XXXXX.COM > wrote in message
news:br3g4e$p2j$ XXXX@XXXXX.COM ...
> hello,
> how to convert char to WCHAR?
> thx
> p.s. i can't even find description of WCHAR type
> unsigned char blah[] = "blah"; -> how it looks in WCHAR??

5.Non ansi wchar convertion to char

Is there a better way to convert wchar to char (or char to wchar) than:

bool wchar2char(const WCHAR * psrc, int srclen, char * pdest, int destlen)
 for (int i = 0; i < srclen; i++)
  pdest[i] = (char)psrc[i];
 return true;

char and wchar can be in the range 0-255 i..e not only ansi.

6. How to copy char* string to a WCHAR[] string

7. TCHAR or char in messages for Controls

8. How to change char a[10] into tchar a[10]

Return to windows ce


Who is online

Users browsing this forum: No registered users and 11 guest