0
Connect LPCWSTRs
Hi, is it possible to connect two LPCWSTRs? e.g.: #include<Windows.h> #include<tchar.h> // ... LPCWSTR a = L"asdf"; LPCWSTR b = L"jklö"; LPCWSTR c = a + b; // error // ... doesn't work. Hope I will get some answers, S.A.
2 odpowiedzi
+ 2
Maybe these can give you a bit of light
https://www.gamedev.net/forums/topic/463564-concatenating-two-lpcwstr/
https://stackoverflow.com/questions/22999996/how-to-concatenate-a-lpcwstr
+ 1
LPCWSTR -> Long Pointer Const Wide STRing = const wchar_t*.
Can you use '+' operator on const char*/wchar_t*? you can't (unless you use C++ std::string/std::wstring or any other std/third party library). So, the way to add to the string/wide string would be using strcat/wcscat method.
#include <iostream>
#include <windows.h>
#include <wchar.h>
int main()
{
LPCWSTR a = L"hello ";
LPCWSTR b = L"world!";
WCHAR buf[13];
wcscpy(buf, a);
wcscat(buf, b);
std::wcout << buf << L'\n';
return 0;
}