1
Network / Download text-file
« on: May 27, 2009, 10:47:18 pm »
VERY BIG THANK, GUY!!!
Soluted the Problem this way:
^^Now the file is saved as bar.ext into the working directory of the project.
Soluted the Problem this way:
Code: [Select]
// Init HTTP Client
sf::Http Http;
// Set the Host
Http.SetHost("www.yourdomain.tld");
// Get the file
sf::Http::Response Response = Http.SendRequest(sf::Http::Request::Request(sf::Http::Request::Method::Get, "http://www.yourdomain.tld/dir/foo/bar.ext"));
// Save the downloaded text into a string
std::string Body = Response.GetBody();
// Save the file
FILE *fTextFile;
fTextFile = fopen("bar.ext", "w" );
fputs(Body.c_str(), fTextFile);
fclose(fTextFile);
^^Now the file is saved as bar.ext into the working directory of the project.