如何组合两个LPCWSTR? [英] how to combine two LPCWSTRs?
本文介绍了如何组合两个LPCWSTR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个变量是 LPCWSTR
s.我想创建一个具有第一个和第二个变量值的新变量.
我试过这个,但没有用.
I have two variables that are LPCWSTR
s. I want to create a new variable that will have the values of the first and second variable.
I tried this but it didn't work.
LPCWSTR d = L"sd";
LPCWSTR f = L"f";
LPCWSTR df = d + f;
我在尝试时收到此错误.
I get this error when i try that.
1 IntelliSense: expression must have integral or enum type
有没有可以组合两个LPCWSTR
的函数?
Is there a function that can combine two LPCWSTR
s?
推荐答案
在 C++ 中,使用 std::string
来处理字符串通常是一个好主意.在您的情况下,它可能看起来像:
In C++ it is usually a good idea to use std::string
for manipulations with strings. In your case it could look like:
LPCWSTR d = L"sd";
LPCWSTR f = L"f";
std::wstring df = std::wstring(d) + f;
LPCWSTR dfc = df.c_str(); // if you are really need this
这篇关于如何组合两个LPCWSTR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文