|
-
June 13th, 2012, 01:17 PM
#1
[RESOLVED] system() reference plz
Hi, seek help again ^^ for a complete reference of the function system() because I want manage folders to backup mysql.
example:
Code:
char backup_path [100]="backup";//"c:\\backup"
if (!folder_exist(backup_path))//check folder
{
//--------------CREATE FOLDER------------------------------------
sprintf_s(my_backup,"md %s", my_backup_path);
system(backup_md);//create sub-folder backup or c:\backup
system("cd backup");//select folder for backup
//--------------DUMP DB------------------------------------------
GetDlgItemText(hwnd,ID_DB_USE,db_use,80);//db select
GetDlgItemText(hwnd,ID_DB_BCK,db_bck,80);//backup name
sprintf_s(db_dump,"mysqldump --opt %s > %s.sql",db_use, db_bck);
system(db_dump);//dump db
}
else
{
/*system("c:");*///dont works
system("cd backup");//select folder for backup
//--------------DUMP DB------------------------------------------
GetDlgItemText(hwnd,ID_DB_USE,db_use,80);//db select
GetDlgItemText(hwnd,ID_DB_BCK,db_bck,80);//backup name
sprintf_s(db_dump,"mysqldump --opt %s > %s.sql",db_use, db_bck);
system(db_dump);//dump db
}
my dump is fine, but... put in root folder no sub-folder backup or c:\backup
Im using win32 api+mysql
-
June 13th, 2012, 01:38 PM
#2
Re: system() reference plz
Why do you use system?
To spawn another process you should use CreateProcess API
Victor Nijegorodov
-
June 13th, 2012, 02:06 PM
#3
Re: system() reference plz
 Originally Posted by VictorN
Why do you use system?
To spawn another process you should use CreateProcess API
Because I did not know that xD, when I need, I try to find.
I resolve:
Code:
SetCurrentDirectory("backup");
system(my_backup_query);
SetCurrentDirectory("..");//to return parent
but now I will try with CreateProcess args, thanks a lot for the quick response.
-
June 13th, 2012, 02:13 PM
#4
Re: [RESOLVED] system() reference plz
 Originally Posted by v_nom70
Hi, seek help again ^^ for a complete reference of the function system()
system
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|