Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
hi i'm sorry for my poor english
i want a program that get many file name from command line (myProject.exe file1.txt file2.txt file3.txt) and copy them in other path exp: D:\ that file name in dest is Upper case

i want it for my teacher tommarow if you can please write that for me.
please help.
[added]
here is the code
C++
#include <iostream.h>
#include <stdio.h>
#include <fstream>
#include <ctype.h>
 
int main(int argc, char* argv[],char* argvNew[])
{
 
for  (int j=1;j<argc;j++)  {
 
     for(int i=0;argv[j][i];i++)
     {
            argv[j][i] = toupper(argv[j][i]);
     }
 
  char buffer[2560];
  ifstream f1 (argv[j],fstream::binary);
  ofstream f2 (strcat("d:\\",argv[j]) ,fstream::trunc|fstream::binary);
  f2<<f1.rdbuf();
 

      }
 

}

[-added]
Posted
Updated 14-Dec-12 20:35pm
v3
Comments
joshrduncan2012 14-Dec-12 9:40am    
Have you tried this yourself? We will not provide code for anyone without seeing effort on your part first.

The definition of main function would be:

C++
int main(int argc,char **argv)


create a function that would do the copy file part

then call the function in loop.


example:
C++
int main(int argc, char **argv)
{
 for(int i=0;i<argc;i++)>
 {
  function_to_copy(argv[i],copied_path);
 }
}
 
Share this answer
 
I suggest you start coding and get your program created. No one here is going to do your homework for you.
 
Share this answer
 
Comments
Behnam Mohammadi 14-Dec-12 11:09am    

#include <iostream.h>
#include <stdio.h>
#include <fstream>
#include <ctype.h>

int main(int argc, char* argv[],char* argvNew[])
{

for (int j=1;j

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900