Sie sind auf Seite 1von 1

#include "std_lib_facilities_3.h" // Program that checks a URL of a .pdf to open it in XMING.

int main() try{ cout << "Please enter the URL of a PDF file.\n"; string url; while(cin >> url){ string str = url.substr (0, 7); string str2 = url.substr (url.length()-3, 3); if (str == "http://" && str2 == "jpg" || str2 == "JPG"){ string command = "wget " + url; system((const char*)command.c_str()); string command2 = "display " + url; system((const char*)command2.c_str()); return 0; } else cout << "URL is not typed correctly, please try again.\n"; } keep_window_open(); return 0; } catch (exception& e) { cerr<<"error: "<<e.what()<<'\n'; keep_window_open(); return 1; } catch(...){ cerr<<"Oops: unknown exception!\n"; keep_window_open(); return 2; }

Das könnte Ihnen auch gefallen