开发者

How to copy files in VC++ ?

开发者 https://www.devze.com 2023-01-01 23:43 出处:网络
I want to copy the files present in a 开发者_运维百科flash drive into hard drives and then run them using a VC++ application. I have VS 2008..?You could use FindFile() to figure out what files are in

I want to copy the files present in a 开发者_运维百科flash drive into hard drives and then run them using a VC++ application. I have VS 2008..?


You could use FindFile() to figure out what files are in the folder..

CopyFile(_T("c:\\test"), _T("c:\\test1"), true);

Then ShellExecute(...)


Use FindFirstFile / FindNextFile / FindClose to enumerate the files on your flash drive. If you determine the file is an executable (say by checking for a .exe extension), then you use CopyFile to copy them to the hard drive you want.

Once they are copied you can use ShellExecute to start them or else CreateProcess if you want control of the process via a process handle.

0

精彩评论

暂无评论...
验证码 换一张
取 消