Click to See Complete Forum and Search --> : Which Command line to use in VC program to copy files from drive C: to Drive A
Qasim Iqbal
August 6th, 1999, 05:27 AM
Dear All,
I am trying to write a code for which on click of a button I want to copy files from drive C: to drive A:
I do not know which command to use. Is it something like "ShellCopy "
Pleaee write me this line of code if you have come across it.
If you can please write a dummy code which I can just copy.
Any help will very much be appreciated.
Please reply to author
Kind Regards
Qasim Raza Iqbal
Lothar Haensler
August 6th, 1999, 06:26 AM
you can use the SHFileOPeration API and use the FO_COPY flag
Qasim Iqbal
August 9th, 1999, 04:48 AM
Dear Sir, I have used the following line and I get errors please see if you could help me Thanks.
SHFileOperation(NULL, FO_COPY, _T("\\SOFTWARE\\ide\\idebat.bat"),"a:\\",NULL);
Please reply to author
Kind Regards
Qasim Raza Iqbal
Lothar Haensler
August 9th, 1999, 04:51 AM
try this
SHFileOperation(NULL, FO_COPY, _T("\\SOFTWARE\\ide\\idebat.bat"),"a:\\idebat.bat",NULL);
and always check for errors using GetLastError and FormatMessage to get a readable error text.
Martin Speiser
August 9th, 1999, 04:51 AM
Hi Qasim,
of course you get an error message becuase SHFileOperation takes only one argument of type LPSHFILEOPSTRUCT, a poiner to a structure. But why don't you use the API function CopyFile simply?
Martin
Qasim Iqbal
August 9th, 1999, 05:42 AM
Hi Martin,
Thanks for the above advice. Please if you could write that line of code I want to copy a file from drive c:\ software to a:\
Your Help will very much be appreciated.
Please reply to author
Kind Regards
Qasim Raza Iqbal
Burlacu Ovidiu
August 9th, 1999, 05:47 AM
Try thsi:
CopyFile("c:\\software\\idle.bat", "a:\\idle.bat", FALSE);
Let me know if this help u
Regards,
Ovidiu
Qasim Iqbal
August 9th, 1999, 06:37 AM
Thanks Mate SORTED
Please reply to author
Kind Regards
Qasim Raza Iqbal
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.