本文介绍了我如何添加两个LPWSTR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 有没有办法添加两个LPWSTR,结果也是LPWSTR? 喜欢...... LPWSTR str1 = L Hello; LPWSTR str2 = L World; LPWSTR str3 = str1 + str2; MessageBoxW( 0 ,str3,L title, 0 ); 解决方案 你不用加号! 你需要wcsncat:http://msdn.microsoft.com/en-us/library/tbyd7s1y.aspx [ ^ ] 添加指针只是一个错误。添加两个 wstring 对象会产生魔力: #include < string > #include < iostream > #include < Windows.h > 使用 命名空间标准; int main() { LPWSTR str1 = L Hello; LPWSTR str2 = L World; wstring w1(str1); wstring w2(str2); wstring w3 = w1 + w2; wcout<< w3<< ENDL; } 尝试使用字符串连接的概念。 我们有strcat和一些连接两个字符串的方法。 请看一次。 Hi, is there a way to add two LPWSTR and the result will also be LPWSTR ?like...LPWSTR str1 = L"Hello ";LPWSTR str2 = L"World";LPWSTR str3 = str1 + str2;MessageBoxW(0, str3, L"title", 0); 解决方案 You don''t do it with plus!You need wcsncat: http://msdn.microsoft.com/en-us/library/tbyd7s1y.aspx[^]Adding the pointers that way is just a mistake. Adding two wstring objects makes the magic:#include <string>#include <iostream>#include <Windows.h>using namespace std;int main(){ LPWSTR str1 = L"Hello "; LPWSTR str2 = L"World"; wstring w1(str1); wstring w2(str2); wstring w3 = w1+w2; wcout << w3 << endl;}try with the concept of string concatenation.we have strcat and some more methods to concatenate two strings.Please have a look at that once. 这篇关于我如何添加两个LPWSTR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 23:51