在C#中,为了发送post数据(WebRequest),我使用了以下代码:
string postData = "username=" + UsernameInput.Text + "&password=" + PasswordInput.Text;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);如何将此代码导入c++。
发布于 2013-08-31 07:08:56
我只想提出你实际提出的问题的答案(以便将来对某人有所帮助):-
String^ postData = "username=" + UsernameInput->Text + "&password=" + PasswordInput->Text;
array<Byte>^byteArray = Encoding::UTF8->GetBytes(postData);发布于 2013-08-31 07:13:12
string也是一个容器,所以:
std::string postData = ... ;
std::vector<std::string::value_type> bytes( postData.begin(), postData.end() );就这样。
https://stackoverflow.com/questions/18545536
复制相似问题