I need to combine "Missing Program File" and a char variable to make an LPCTSTR, which is a Windows typedef to a wchar_t. Also, what is the difference between char and wchar_t? Why can't you interchange them?
I need to combine "Missing Program File" and a char variable to make an LPCTSTR, which is a Windows typedef to a wchar_t. Also, what is the difference between char and wchar_t? Why can't you interchange them?
Char is one byte, while wchar_t is 2 bytes.
Char, when used for strings, *generally* uses the ASCII character set, while wchar_t *generally* uses the Unicode set.
I think
Okay, so how do I combine two wchar_t's into one?
You could just write your own. You do know what a loop is, right?
Quzah.
Hope is the first step on the road to disappointment.
Most of the C standard library functions are available in wide character versions. Include the header file <wchar.h>. Functions you may be interested in are wcscat and swprintf. Check out wchar.h for more functions.
A C++ friendly solution is to use a wstring. This is the wide character equivalent of string.
Another alternative are the safer string handling function in <strsafe.h>.
>> LPCTSTR, which is a Windows typedef to a wchar_t <<
Actually, a LPCTSTR is, by default, a const char*. If you define UNICODE before including any headers, it becomes a const wchar_t*. This allows you to write code that can be compiled as either unicode or ansi. If you don't care about supporting unicode, you can just treat a LPCTSTR as a const char*. There are TCHAR equivalent macros for the C standard library string functions in <tchar.h>.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Last edited by anonytmouse; 01-23-2005 at 11:39 PM.