Nytro Posted November 13, 2011 Report Posted November 13, 2011 [C] UnicodeToString - StringToUnicode Author: Xash#include <windows.h>void UnicodeToString(const wchar_t* pStringW, char* pStringA, const int stringLength){ int i = 0; while(i < stringLength) { *(pStringA + i) = (char)(BYTE)*(pStringW + i); i++; } *(pStringA + i) = (char)0x00;}void StringToUnicode(const char* pStringA, wchar_t* pStringW, const int stringLength){ int i = 0; while(i < stringLength) { *(pStringW + i) = (wchar_t)(BYTE)*(pStringA + i); i++; } *(pStringW + i) = (wchar_t)0x00;}int main(){ wchar_t testStringW[20] = L"I'm a test!"; char testStringA[20] = {""}; UnicodeToString(testStringW, testStringA, lstrlenW(testStringW)); MessageBoxA(0, testStringA, "Hello", MB_OK); return 0;}Sursa: UnicodeToString - StringToUnicode Quote
cifratorul Posted November 14, 2011 Report Posted November 14, 2011 nu cred ca sunt corecte aceste functii (vezi si comentariile din link-ul sursa). folositi functiile din win32 api care fac asta: WideCharToMultiByte si MultiByteToWideChar Quote
Nytro Posted November 14, 2011 Author Report Posted November 14, 2011 Da, stiu de functii, dar asta mi s-a parut banal. Bine, nu l-am incercat, dar speram sa mearga. Quote