additional info im building an application which use the WinHttpOpenRequest Api which requires LPCWSTR for the object name and im using visual studio 2008
The simplest way is to use ATL:
#include <Windows.h>
#include <atlbase.h>
#include <iostream>
int main(int argc, char *argv[]) {
USES_CONVERSION;
LPCSTR a = "hello";
LPCWSTR w = A2W(a);
std::wcout << w << std::endl;
return 0;
}
Any memory allocated by A2W (ANSI to Wide) will be freed when the function exits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With