Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #pragma warning (disable : 4996)
- char* conversion(LPCTSTR val)
- {
- LPCWSTR wstr = val;
- int count = wcslen(wstr);
- char* c = new char[count + 1];
- wchar_t* pwchr = const_cast<wchar_t*> (&wstr[0]);
- for(int j = 0; j < count; ++j)
- {
- c[j] = static_cast<char> (*pwchr);
- pwchr++;
- }
- c[count] = '\0';
- wcstombs(c,val,count);
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement