Reputation: 51
In C# to send the post data(WebRequest) I used this code:
string postData = "username=" + UsernameInput.Text + "&password=" + PasswordInput.Text;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
How do I import this code to c++.
Upvotes: 1
Views: 132
Reputation: 172628
Just trying to put the answer which you have actually put with the question(So that it may help someone in future):-
String^ postData = "username=" + UsernameInput->Text + "&password=" + PasswordInput->Text;
array<Byte>^byteArray = Encoding::UTF8->GetBytes(postData);
Upvotes: 1
Reputation: 8824
std::string is also a container so :
std::string postData = ... ;
std::vector<std::string::value_type> bytes( postData.begin(), postData.end() );
That's all.
Upvotes: 0