pradeep
pradeep

Reputation: 3095

How to copy files in VC++ ?

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..?

Upvotes: 1

Views: 2326

Answers (2)

Brian R. Bondy
Brian R. Bondy

Reputation: 347216

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.

Upvotes: 0

baash05
baash05

Reputation: 4516

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

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

Then ShellExecute(...)

Upvotes: 2

Related Questions