如何将@符号连接到C ++ / CLI托管字符串 [英] How do I concatenate @ symbol to a C++/CLI managed String
本文介绍了如何将@符号连接到C ++ / CLI托管字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要将@符号连接到C ++ / CLI中的字符串,如下所示。
Ex:
Hi All,
I need to concatenate "@" symbol to a string in C++/CLI as follows.
Ex:
String^ str1 = "OXF";
String^ str2 = "@"+ str1;
但我收到的编译错误如下:你能否告诉我如何解决它们。
But i am getting compile errors saying as follows: Could you please let me know how to resolve them.
NotificationManager.cpp(127) : error C2018: unknown character '0x40'
NotificationManager.cpp(127) : error C2065: '"': undeclared identifier
NotificationManager.cpp(127) : error C2146: syntax error : missing ';' before identifier '"'
NotificationManager.cpp(127) : error C2065: '"' : undeclared identifier
谢谢,
Sudhakar
Thanks,
Sudhakar
推荐答案
像理查德一样,我试过你的代码,即
Like Richard, I tried your code, namely
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
String^ str1 = "OXF";
String^ str2 = "@" + str1;
Console::WriteLine(str2);
return 0;
}
编译并在我的电脑上正常运行。
可能有问题你的编译环境。
compiles and runs fine on my PC.
Possibly there is something wrong in your compilation environment.
这篇关于如何将@符号连接到C ++ / CLI托管字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文