I'm a C++ student needing help with writing a program to capture product details in a text file and store the same details in 500 external files. I'm able to create a single file, but after that...
generate 500 file names programatically, and copy contents of old file.
eg:
1 2 3 4 5 6 7
for(int i=1;i<500;i++)
{
String filename="path\\xyz_fileno"+i+"fileextension like .txt";
ifstream ifs_current(filename);
//open original file copy it to current file
}
The Windows API also provides a copy function (CopyFile), whereas POSIX appears not to (Boost uses CopyFile on Windows but a custom copy routine on other platforms; they do not use sendfile.)
Thanks @andywestken, yes, the text files are small, so using an fstream loop.
@SirSmilesaLot, i have incorporated that into my code below, still doesn't work and I can't figure out where I'm going wrong. Some more help please?