Mostly this comes about by not writing Unicode-aware code. You should not call atof, which
only works on 8-bit characters; you should always call ttof. Never use char * in writing
code; use LPTSTR. Your version of VS6 has it; it is defined in tchar.h. Note that you need
to install the Unicode libraries; most of the Unicode support did not install by default.
Just go to Add/Remove programs, select Visual Studio, and go into the install wizard and
add various Unicode-based options for libraries and such (while you're at it, install the
C runtime source code as well; it is useful to have around).
Note that you must specify both the UNICODE and _UNICODE preprocessor symbols (one
controls the C library, one controls the WIndows library, and if you don't specify both,
you would get errors like the one you have cited). strstream is part of the standard C++
library, which sucks as far as Unicode support is concerned, since it is still living in
the early days of C++ (and hasn't grown up). I suggest avoiding anything like this. It is
one of the several reaons I avoid the "standard" C++ library. It lives in some weird world
that never heard of Unicode.
joe
On Thu, 8 Jan 2004 14:56:08 -0700, "XL Zhou" <
xuelong@pvtprop.com>wrote:
Quote
Hello,
I didn't think it would be so much pain to convert to UNICODE. The problems
I have so far are:
1. I can't use atof() to convert a string to float number. Someone said to
use _tstof() (wtof()). But my version of VS6 doesn't have that (not in my
MSDN either - July2001). Someone must have done unicode at that time. What
was the solution then?
2. It is so odd that I can't use _tcsncpy() or lstrcpyn() to copy 2 strings,
eg.
CHARFORMAT cfThis;
LPCTSTR sFaceName;// from calling function
_tcsncpy(cfThis.szFaceName, sFaceName, LF_FACESIZE);
The message is {cannot convert parameter 1 from 'char [32]' to 'unsigned
short *'; Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast}
cfThis.szFaceName is TCHAR[], in unicode it would have been WCHAR[], I don't
know why it becomes char[32]. Can someone help please?
3. strstream doesn't seem to work in unicode. What is the alternative?
Please help. Thanks.
XL
Joseph M. Newcomer [MVP]
email:
newcomer@flounder.com
Web:
www.flounder.com">
www.flounder.com
MVP Tips:
www.flounder.com/mvp_tips.htm">
www.flounder.com/mvp_tips.htm
-