wstring en Multibyte Character Set
Bonjour :D,
J'ai un projet réglé sur Multibyte Character Set avec Visual C++2005 et je souhaiterais addapter un code source qui lui est réglé sur Unicode Character Set ...
Les erreurs ont lieu ici:
[device.h]:
Code:
1 2 3 4
| wstring m_device_path_name;
...
T device
device.m_device_path_name = detailData->DevicePath; |
error C2679: binary no operator found wich takes a right-hand operant of type 'CHAR[1]
modifié ça donne :
Code:
1 TCHAR* m_device_path_name;
[device.cpp]:
Code:
1 2
| wstring empty = _T("");
device.m_event_object = CreateEvent (NULL, TRUE, TRUE, empty.c_str()); |
...modifié donne:
Code:
1 2
| LPCSTR empty =reinterpret_cast<LPCSTR>("");// L"";
device.m_event_object = CreateEvent (NULL, TRUE, TRUE, empty); |
Au final, ça compile mais pendant l'execution ça finit par planter :
Unhanced exeption at 0x7c812aeb in Test.exe...std::exception at memory location 0x0013f764
Pourriez-vous m'aider à y voir plus clair dans l'adaptation d'un code Unicode vers Multibyte, avec les wstring, TCHAR, LPCTSTR...?