Hi Im new to the whole thing of programming and would like to write a C++ program to copy files from one drive to another, any help and suggestions on where to start?

Any help with source code or pointers will be greatly appreciated. The OS the program is for is WINCE 4.2 .net embedded.

Thanks in advance

Recommended Answers

All 2 Replies

To copy a file you basically need to first read that file. To do this read about opening ifstreams as binary files ( http://www.cplusplus.com/reference/iostream/istream/read.html ), might want to edit that code a bit. Then you'll want to save the contents of what you read to an output file, ofstream is your weapon of choice here ( http://www.cplusplus.com/reference/iostream/ostream/write.html )... In fact the latter link has basically your program... Write some user-input/command line parameter processing around it to allow a user to select the input and output files and hey presto done.

Windows CE has APIs for this kind of thing. The prototype for the function is

BOOL CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists);

.

Go to MSDN if you need info on return values, etc. try http://msdn.microsoft.com/en-us/library/ms959899.aspx

commented: Easy money :) +22
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.