Hello
This basic FTP-code ain't working for some reason. I don't get an error while compiling, but only when running.
Code:#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>
using namespace std;
int main() {
sf::Ftp ftp;
sf::Ftp::Response resp;
//I have emptied these variables for this post
string server = "";
string user = "";
string pass = "";
string file = "";
string dest = "";
resp = ftp.connect(server, 21, sf::seconds(120));
if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
resp = ftp.login(user, pass);
if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
resp = ftp.download(file, dest, sf::Ftp::Ascii);
if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
ftp.disconnect();
cin.ignore().get();
return 0;
}
G++:g++ c:/users/name/desktop/test3.cpp -o c:/users/name/desktop/test3 -lsfml-system -lsfml-network -std=c++11
I am using Windows 8.1, and MinGW to use G++.
I have no compiling errors, only when I execute the executable (test3.exe) I get the "test3.exe doesn't work anymore, search online for solutions ...".
Details of that error:
Probleemhandtekening:
Gebeurtenisnaam van probleem: APPCRASH
Naam van de toepassing: test3.exe
Versie van toepassing: 0.0.0.0
Tijdstempel van toepassing: 571b7a03
Naam van foutmodule: libstdc++-6.dll
Versie van foutmodule: 0.0.0.0
Tijdstempel van foutmodule: 55b39025
Uitzonderingscode: c0000005
Uitzonderingsmarge: 00021225
Versie van besturingssysteem: 6.3.9600.2.0.0.768.101
Landinstelling-id: 2067
Aanvullende informatie 1: 5861
Aanvullende informatie 2: 5861822e1919d7c014bbb064c64908b2
Aanvullende informatie 3: bb02
Aanvullende informatie 4: bb02c3b29c3f075104f1d0629e885cfc
Translation to EnglishAlso note, that when I request a non existing file on the server, I get a SFML-error but the executable itself doesn't crashes. It only crashes when the file actually does exist...
Why ain't this basic code working?
Thanks!