C++ cli 在C+中使用文本编码+/CLI
我正在使用: 连接并从服务器获取信息。这是我的代码:C++ cli 在C+中使用文本编码+/CLI,c++-cli,C++ Cli,我正在使用: 连接并从服务器获取信息。这是我的代码: // Connect to the server TcpClient^ client = gcnew TcpClient( "1.1.1.1", 45257 ); // Get stream NetworkStream^ stream = client->GetStream(); // Data to send array<Byte>^data = Text::Encoding::ASCII->GetBytes(
// Connect to the server
TcpClient^ client = gcnew TcpClient( "1.1.1.1", 45257 );
// Get stream
NetworkStream^ stream = client->GetStream();
// Data to send
array<Byte>^data = Text::Encoding::ASCII->GetBytes( message );
// Send data to server
stream->Write( data, 0, data->Length );
这是windows窗体应用程序的内部
任何帮助都将不胜感激。谢谢在using指令中指定名称空间,
using namespace System::Text代码>,或者指定完整名称的类名,<代码>系统::文本::编码< /COR> .< /P>作为一个旁白,为什么你使用C++的代码>系统::NET::Soops<代码> > C++,它直接访问Winsock API,它更强大,更高效,而且在很多方面也更友好?
error C3083: 'Encoding': the symbol to the left of a '::' must be a type
error C2039: 'ASCII' : is not a member of 'System::Windows::Forms::Form::Text'
error C2065: 'ASCII' : undeclared identifier
error C2227: left of '->GetBytes' must point to class/struct/union/generic type