Which Command line to use in VC program to copy files from drive C: to Drive A
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
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
you can use the SHFileOPeration API and use the FO_COPY flag
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
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
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
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.
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
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
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
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
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
Try thsi:
CopyFile("c:\\software\\idle.bat", "a:\\idle.bat", FALSE);
Let me know if this help u
Regards,
Ovidiu
Re: Which Command line to use in VC program to copy files from drive C: to Drive A
Thanks Mate SORTED
Please reply to author
Kind Regards
Qasim Raza Iqbal