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 English (https://translate.google.com/#nl/en/Probleemhandtekening%3A%0A%20%20Gebeurtenisnaam%20van%20probleem%3A%09APPCRASH%0A%20%20Naam%20van%20de%20toepassing%3A%09test3.exe%0A%20%20Versie%20van%20toepassing%3A%090.0.0.0%0A%20%20Tijdstempel%20van%20toepassing%3A%09571b7a03%0A%20%20Naam%20van%20foutmodule%3A%09libstdc%2B%2B-6.dll%0A%20%20Versie%20van%20foutmodule%3A%090.0.0.0%0A%20%20Tijdstempel%20van%20foutmodule%3A%0955b39025%0A%20%20Uitzonderingscode%3A%09c0000005%0A%20%20Uitzonderingsmarge%3A%0900021225%0A%20%20Versie%20van%20besturingssysteem%3A%096.3.9600.2.0.0.768.101%0A%20%20Landinstelling-id%3A%092067%0A%20%20Aanvullende%20informatie%201%3A%095861%0A%20%20Aanvullende%20informatie%202%3A%095861822e1919d7c014bbb064c64908b2%0A%20%20Aanvullende%20informatie%203%3A%09bb02%0A%20%20Aanvullende%20informatie%204%3A%09bb02c3b29c3f075104f1d0629e885cfc)
Also 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!