能否帮忙C++改成C# 呢。感谢
希望把以下C++代码改成C#,非常感谢!
CString strSend ="XXXXXBBBBBBBBBBBBBBBBBB";
int len=senddata(strSend.GetBuffer(strSend.GetLength()),strSend.GetLength());
int CVC6ClientDlg::senddata(char * buf,int num)
{
char sendbuf[512];
memcpy(sendbuf,buf,num);
sendbuf[num]='\n';
return SSL_writego(ssl, sendbuf, num+1);
}
[解决办法]
String strSend = "XXXXXBBBBBBBBBBBBBBBBBB";
byte[] byteSend = Encoding.UTF8.GetBytes(strSend);
int len = senddata(byteSend, byteSend.Length);
int senddata(byte[] buf, int num)
{
byte[] sendbuf = new byte[num+1];
buf.CopyTo(sendbuf, 0);
sendbuf[num] = (byte)'\n';
return SSL_writego(ssl, sendbuf, num+1);
}