Hello,
it's my first steps in SFML, so please be patient. I have prepared SFML libraries for Microsoft Visual Studio 2013 Express which I am using to develop my app. I am trying to send http request but I am unable because of std::bad_alloc error. I know that it is associated with memory management but I am doing everything like in SFML tutorial.
Below is my function that I want to use to create request:
void apiReseller::openToken()
{
string requestBody = "api_key=" + apiKey;
sf::Http httpTokenRequest;
httpTokenRequest.setHost(apiAddress);
sf::Http::Request openTokenRequest;
openTokenRequest.setMethod(sf::Http::Request::Post);
openTokenRequest.setBody(requestBody);
openTokenRequest.setUri("/token");
sf::Http::Response openTokenResponse = httpTokenRequest.sendRequest(openTokenRequest);
cout << openTokenResponse.getBody();
}
Build process is OK but when program reaches line httpTokenRequest.setHost(apiAddress); it throws an exception std::bad_alloc.
And there is one more thing, when I will set Linker->Generel->Register Output as yes I receive another error when compiling:
Error 4 error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 1620 5 importApiAccounts
Maybe it causes my error with memory?
Please help me if you could, it is second day when I am trying to use this library.