Hello,
This compiles OK using Multi-Byte character set,
but when I switch to Unicode I get an error.
char reply[256] = _T("olleh");
I know this will fix the error with the Unicode compile,
wchar_t reply[256] = _T("olleh");
but this causes many other conversion problems in the program.
Is there some other conversion macro that I could use instead of _T(),
instead of having to change from char to a wchar_t?
Thanks,
-JC 5 1623
Hi jc!
char reply[256] = _T("olleh");
You should get used to TCHAR:
TCHAR reply[256] = _T("olleh");
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
jc wrote:
Hello,
This compiles OK using Multi-Byte character set,
but when I switch to Unicode I get an error.
char reply[256] = _T("olleh");
I know this will fix the error with the Unicode compile,
wchar_t reply[256] = _T("olleh");
but this causes many other conversion problems in the program.
Is there some other conversion macro that I could use instead of _T(),
instead of having to change from char to a wchar_t?
JC:
You have to write
TCHAR reply[256] = _T("olleh");
if you still want to compile for multi-byte,
or
wchar_t reply[256] = L"olleh";
if you only need to compile for Unicode.
If these cause problems for your code, these problems need to be fixed.
You would not be having this problem if you had used TCHAR, _T("") etc originally.
--
David Wilkinson
Visual C++ MVP
"jc" <jc@discussions .microsoft.comh a scritto nel messaggio
news:08******** *************** ***********@mic rosoft.com...
Hello,
This compiles OK using Multi-Byte character set,
but when I switch to Unicode I get an error.
char reply[256] = _T("olleh");
Because when you switch to Unicode, _T("...") macro expands to L"...", so
your code becomes:
char reply[ 256 ] = L"olleh"
which is wrong (because the L"olleh" is a wchar_t string, not a char
string).
I know this will fix the error with the Unicode compile,
wchar_t reply[256] = _T("olleh");
but this causes many other conversion problems in the program.
The correct code should be:
TCHAR reply[ 256 ] = _T("olleh");
TCHAR will expands to wchar_t in Unicode builds, and to char in ANSI/MBCS
builds.
BTW: why don't you use CString instead of raw TCHAR arrays?
Is there some other conversion macro that I could use instead of _T(),
instead of having to change from char to a wchar_t?
If you want to convert from generic TCHAR to char, you may want to use ATL
helper classes, like CT2A:
CT2A reply( _T("olleh") );
Both in Unicode and in ANSI/MBCS builds, your 'reply' variable is a RAII
buffer made by char's.
More information here: http://msdn.microsoft.com/en-us/library/87zae4a3.aspx
HTH,
Giovanni
"Jochen Kalmbach [MVP]" wrote:
Hi jc!
char reply[256] = _T("olleh");
You should get used to TCHAR:
TCHAR reply[256] = _T("olleh");
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
Hi Jochen,
Thanks for replying to my post. Yes, the TCHAR worked, and the other
conversions throughout the program were not that painful !!
-jc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dennis Wheeler |
last post by:
I'm trying to find a commandline solution for switching projects.
Currently I have to modify the IIS virtual directory path to the
source files, and then open the solution file in .Net to be prompted
with the "Web Access Failed" dialog, where I can then modify the path
to match my IIS settings.
Is there a registry setting or some other method of moving the
solution path without having to physically open the solution file in
the IDE?
|
by: MLH |
last post by:
I seem to remember a post in the distant past
discussing how to switch to another open application
window. IE, if WordPad is running, some API function
that'll allow me to switch the focus to that application?
Ring any bells with anyone? I have searched Google
for "switching to an open application from code" and
"switching applications". But all I found were a few
blurbs about ALT-TAB.
|
by: Johann Blake |
last post by:
The following is a bug I have discovered using tab pages and threads
and I am looking for a workaround.
Create a new Windows Forms application and add a tab control with two
tab pages. Add a label to each tab page. On the first tab page add a
button. When the button is pressed the code behind the button creates
a thread and starts that thread. The only thing that the thread is to
do is to switch from the first tab page to the 2nd tab...
|
by: Erick Korsten |
last post by:
I am working with VB.NET and I created a fairly big application (about 15
dll's and a main process). When I switch between Debug mode and Release mode
or back, it takes the Development Environment about 7 minutes to process
before I can do anything. My PC has enough memory (256M) and is pretty fast,
so that is not the problem.
Does anyone have the same problem? Does anyone know what the cause is for
this problem and how to avoid it?
|
by: abdulics |
last post by:
Hi,
We have immediate openings with one of our Top Notch Telecom clients
for their Research and Development Center in Bangalore.
Please send me your detailed/brief profile to
k.abdulrasheed@icsconsultancy.com
Our top notch and reputed client deliver complex IT solutions on
leading edge Technologies. Our client has recently made a strong entry
into the secure enterprise networking space and is currently developing
| |
by: abdulics |
last post by:
Hi,
We have immediate openings with one of our Top Notch Telecom clients
for their Research and Development Center in Bangalore.
Our top notch and reputed client deliver complex IT solutions on
leading edge Technologies. Our client has recently made a strong entry
into the secure enterprise networking space and is currently developing
several new platforms and features in this space. It is a once in a
lifetime opportunity to be a part...
|
by: Frank Swarbrick |
last post by:
I had asked a question a few weeks ago about having problems at times
accessing DB2 Express-C 9.1, and getting "SQL1032N No start database manager
command was issued. SQLSTATE=57019" even when the database was in fact
started.
Looks like this is a known issue having to do with "fast user switching".
See the following for more information:
http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=805&thread=
147195&cat=19
|
by: don |
last post by:
Hi,
I redesigned a website and changed from table code to pure CSS. A a
result, something strange has occured. In IE and Opera, all is OK.
However, in Firefox and Netscape, some of my links no longer work.
For an example, go to: http://www.fivestarterminals.com/
Half way down is a "contact us" link. It is active using IE but
innactive using Firefox.
|
by: Dave Rado |
last post by:
Hi
A while ago I discovered a way of creating css pseudo-frames, that
offer users the important benefits of real frames (i.e. the navigation
remains visible when you scroll down the page), but without most of
the drawbacks (in particular, unlike real frames, this method is
bookmarks-friendly and search engine-friendly). However, the method
still has sufficient drawbacks from an accessibility point of view
that I have been planning to...
|
by: adlloyd |
last post by:
Hi all,
I've got an application that's written in C++ making use of MFC (VS6). Its purpose is to process SMS messages received from a GSM modem connected via a serial port (USB connection). The serial communications are handled entirely in their own thread.
For the most part this works perfectly.However, there appears to be a problem where multiple instances of the application are running in different Windows XP environments.
It seems...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |