fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9. string filespath;
  10. string backupname;
  11. string serverpath;
  12. string command;
  13. cout << "Enter full path of site data to compress: ";
  14. cin >> filespath;
  15. cout << "Enter backup file name";
  16. cin >> backupname;
  17. backupname+=".tar";
  18. cout << "Enter destination path";
  19. cin >> serverpath;
  20.  
  21. cout << "Now a shell script will run and compress your data then upload it to the server" <<endl <<"Please be patient...";
  22.  
  23. command = string("./upload.sh ")+filespath+string(" ")+backupname+string(" ")+serverpath;
  24. system(command);
  25.  
  26. cout << "Done!";
  27. return 0;
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:24:16: error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
  system(command);
                ^
stdout
Standard output is empty