Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ cli 在C+中使用文本编码+/CLI_C++ Cli - Fatal编程技术网

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