Hello guys,
I tried this:
#include <SFML/Network.hpp>
#include <map>
#include <list>
#include <string>
#include <cstdio>
bool retrieveLines( const std::string& url, const std::string& file, const std::map< std::string, std::string >& params, std::list< std::string >& out )
{
sf::Http http( url );
sf::Http::Request req( file );
req.setMethod(sf::Http::Request::Get);
req.setBody("");
req.setHttpVersion(1, 0);
for ( std::map< std::string, std::string >::const_iterator cit( params.begin( ) ) ; cit != params.end( ) ; ++cit )
req.setField( cit->first, cit->second );
sf::Http::Response res = http.sendRequest( req );
if ( res.getStatus( ) == 200 )
{
printf( "body from %s:\n%s\n", url.c_str( ), res.getBody( ).c_str( ) );
return true;
}
return false;
}
int main( int argc, char** args )
{
std::map< std::string, std::string > pars;
std::list< std::string > lines;
retrieveLines( "joshua-behrens.de","/index.php", pars, lines );
return 0;
}
But it always closed my console with a very high return number. It is also undebuggable. gdb stops neither on any breakpoint nor any other point where an error could occur. But gdb is fine in other projects. DLLs are with the console, I linked against network-d and system-d. Any hints?
Thanks in advance, JoshuaBehrens
I start C::B as admin (so the toolchain should too?) I just link against network and system using this command: -lsfml-network-d -lsfml-system-d, SFML_STATIC is not defined due to this snippet in front
#ifdef SMFL_STATIC
#error does not work with static
#endif // SMFL_STATIC
and it compiled fine.
The compiled application asks for sfml-network-d-2.dll, but I only have sfml-network-d.dll from the compilation of SFML 2. I renamed the dll then I throws this error.
than I just say I used the latest SFML 2 ^^
I would also be fine when I have to use boost::asio, because it's just about a filedownload, but SFML has an easier interface for http.