Im using the system comand to copy a file to another directory however the new dir/file name is specified on runtime, I thought I coudl use the system comand in a similar way to the printf command.. but no joy, any help on this would be appriciated...
Look at FAQ for this forum, esp. faq101-1950 through faq101-1954. I would recommend one of the ShellExecute commands or CreateProcess.
There are also API's and third-party VCL components that will work, too. These work best if you are working with multiple files since they provide the copy animation you see in Windows.
James P. Cottingham
----------------------------------------- To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
void ZipBackup (char *targetdir)
{
char *buff1 = new char [256];
char *buff2 = new char [256];
// Check for the backup directory.
if (!DirectoryExists(zipdir))
CreateDir(zipdir);
// Change to the backup directory.
chdir (zipdir);
// Create the command string for the system call to winzip.
if (FileExists ("c:\\windows\\command\\wzzip.exe"))
{
strcpy (buff1, "wzzip -rp ");
ProgressForm->RichEdit1->Lines->Add ("Run winzip command line addon");
}
// Create the command string for the system call to pkzip.
else if (FileExists ("c:\\windows\\command\\zip.exe"))
{
strcpy (buff1, "zip -r ");
ProgressForm->RichEdit1->Lines->Add ("Run PKzip Compression software");
}
else
{
ProgressForm->RichEdit1->Lines->Add ("The compression software could");
ProgressForm->RichEdit1->Lines->Add ("not be found. ");
return;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.