How to TURN UNICODE ON.
-
Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.
-
Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.
Have you also defined
UNICODE
(in addition to_UNICODE
)? Make sure they are both defined as close to the top ofstdafx.h
as possible. With both defined,TCHAR
will resolve tounsigned short
. Otherwise it will resolve tochar
.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
Have you also defined
UNICODE
(in addition to_UNICODE
)? Make sure they are both defined as close to the top ofstdafx.h
as possible. With both defined,TCHAR
will resolve tounsigned short
. Otherwise it will resolve tochar
.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.
-
Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.
#ifdef _UNICODE
swprintf(...);
#else
sprintf(...);
#end
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
-
#ifdef _UNICODE
swprintf(...);
#else
sprintf(...);
#end
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
Thx again. Now everything works perfectly but the code is unreadable :rolleyes:
-
Txs. This was fast. Now how do i get i get sprintf working. (i do not want to use swprintf because it is unicode only) For printf there is at least _tprintf , but i can find anything for sprintf. Is there an euivelent and if not how can i redirect the ourput to a TCHAR variable. Thx in advance.
Use
_stprintf()
See the full list of macros here[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot stop me with paramecium alone! -
Thx again. Now everything works perfectly but the code is unreadable :rolleyes:
Try looking at this article[^] in the MSDN. It describes the tchar.h mappings, which include
_TCHAR
equivalents for virtually all of the C runtime string routines.
Software Zen:
delete this;
-
Hi all. Using TCHAR is fine, but i wanted to know if there would be a way of turning UNICODE on for my application (#define _UNICODE does nothing). Needed for testing (I fear LOTS of errors X| ). Please help.
for that u have to change settings. step1: go to project->settings->c/c++->cateogery in that select preprocessor. in preprocessor defnitions txt box _MBCS to _UNICODE step2: in link tab goto category.select output. in entry point textbox write this 'wWinMainCRTStartup' Thats all.