Hello All;
I am almost done...
Below is my code. notice how I build toDo. I need this built string to be executed by system(). I will not compile. Here is the code and error:
Code:
// test-app.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <ctime>
#include "string.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
//system("c:\progra~1\PostgreSQL\8.1\bin\pg_dump focus > \\10.1.65.30\smbtes\backup.backup");
string filename;
char dateStr[9];
string toDo;
//_strdate(dateStr);
_strdate_s(dateStr);
filename = "Backup-";
filename = filename + dateStr;
filename = filename + ".backup";
toDo = "pg_dump -h localhost -U swanley007 focus > \\\\10.1.2.16\\smbtest\\";
toDo = toDo + filename;
//cout << filename << endl;
//cout << toDo << endl;
int i;
puts ("Trying to execute command PG_DUMP");
i= system (toDo);
//i= system ("pg_dump -h localhost -U swanley007 focus > \\\\10.1.65.30\\smbtest\\backup.backup");
//i = system ("pg_dump focus > \\10.1.65.30\smbtest\backup.backup");
system ("pause");
return 0;
}
c:\documents and settings\stan swank ii\my documents\visual studio 2005\projects\test-app\test-app\test-app.cpp(32) : error C2664: 'system' : cannot convert parameter 1 from 'std::string' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Build log was saved at
Thanks for any help