In order to automate some backups that need to be done routinely, then I thought of using an app in dos
to do, however I'm having problems compiling the executable because it seems to me that the function
only accepts char variables, the code I used was as follows. system()
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
string usuarios[5] = {"usuario","usuario","usuario","usuario","usuario"};
string diretorios[5];
string path[28];
for (int i = 0; i < 5; ++i) {
diretorios[i] = "mkdir c:\backups\"+usuarios[i];
system(diretorios[i]);
path[i] = "c:\unisystem\backup\"+usuarios[i];
system("exp system/abcd owner="+usuarios[i]+" file="+path[i]+"\"+usuarios[i]+".dmp log="+path[i]+"\"+usuarios[i]+".log compress=n");
}
cout << "O processo de backup terminou!"<< endl;
system("pause");
return 0;
}
Is there another function that I can replace with system()
or do I have to convert string to char?