Hi, so im trying to implement a program that simulates the linux cp command. My program copies the content of one file to another and also copies a file to a direcotry in the current directory. Below is my main () function that works for these cases
But Im trying to add a loop so that i can copy multiple files to a directory at the same time. The loop should do the following:
- loops through all my arugments ( so from av[1] to av[ac-2])
- copy it to dest
- passes av[i] and av[ac-1] to a function i have called copyFile where i is the loop index.
How do i do this? Im not sure how make a loop to go through all my arguments.
Something along these lines perhaps (this uses std::experimental::filesystem library; the logic for handling command line arguments would remain the same if we use platform-specific functions instead):