Hi I need to make multiple copies of a file using Dev-C++ can anyone help?
CodeBoy101 -2 Junior Poster in Training
Recommended Answers
Jump to Postjust write it multiple times using a different filename each time. Or write the first file then call os-specific command to make additional copies.
Jump to Postwhy do you think CopyFile won't work for you? Its one of the easiest win32 api functions you can use.
for(i = 0; i < NumberFiles; i++) { CopyFile(OriginalFilename, filename[i], FALSE); }
Jump to PostLets say you want the file names to be
MultipleFileCopyModule1.exe
MultipleFileCopyModule2.exe
MultipleFileCopyModule3.exeTo accomplish that you have a couple options:
1:) call CopyFile three timesstd::string filename = "C:\\Dev-Cpp\\Programs\\MultipleFileCopyModule"; CopyFile((std::string)(filename+".exe").c_str(), (std::string)(filename+"1.exe").c_str(),false); CopyFile((std::string)(filename+".exe").c_str(), (std::string)(filename+"2.exe").c_str(),false); CopyFile((std::string)(filename+".exe").c_str(), (std::string)(filename+"3.exe").c_str(),false);
2) Use a loop if the number of names is unknown …
All 9 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
CodeBoy101 -2 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
CodeBoy101 -2 Junior Poster in Training
Salem 5,265 Posting Sage
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
CodeBoy101 -2 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
CodeBoy101 commented: perfect! +1
CodeBoy101 -2 Junior Poster in Training
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.