【发布时间】:2011-02-24 05:53:58
【问题描述】:
我想在 C++ 中连接 2 个字符串,我不能使用 char*。
我尝试了以下方法但不起作用:
#define url L"http://domain.com"
wstring s1 = url;
wstring s2 = L"/page.html";
wstring s = s1 + s2;
LPOLESTR o = OLESTR(s);
我需要一个 s1 和 s2 连接的字符串。有任何信息或网站可以对此进行更多解释吗?谢谢。
【问题讨论】:
-
@Joe: [typedef basic_string
wstring; ](msdn.microsoft.com/en-us/library/wt3s3k55%28VS.80%29.aspx) -
没有
#include <string>,也没有using namespace std。
标签: c++ string bho concatenation wstring