you can not just typecase from char* to wchar_t*. You have to call one of the transformation functions.
This works ok for me when the program is not compiled for UNICODE
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char S1[] = "C:\\Program Files" ;
char S2[]= "Zebra";
strcpy(S1,S2);
cout << S1 << "\n";
}
And the UNICODE version
#include <iostream>
#include <tchar.h>
using namespace std;
#ifdef _UNICODE
#define COUT wcout
#else
#define COUT cout
#endif
int main()
{
TCHAR S1[] = _TEXT("C:\\Program Files") ;
TCHAR S2[]= _TEXT("Zebra");
_tcscpy(S1,S2);
COUT << S1 << _TEXT("\n");
}
With the above code you can compile the program with our without UNICODE and the compiler will make appropriate conversions for you.
If you are not really interested in UNICODE then just turn it off and code normally as in my first code snippet. To turn it off select menu item Project --> Properties --> Configuration Properties --> General. Then on the right side of the screen change the "Character Set" list box to "Not Set".
Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343