Click here to Skip to main content
11,579,093 members (63,822 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ GimmeCode Homework
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
#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 14-Dec-12 3:39am
Edited 14-Dec-12 20:35pm
v3
Comments
joshrduncan2012 at 14-Dec-12 9:40am
   
Have you tried this yourself? We will not provide code for anyone without seeing effort on your part first.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I suggest you start coding and get your program created. No one here is going to do your homework for you.
  Permalink  
Comments
Behnam Mohammadi at 14-Dec-12 11:09am
   

#include
#include
#include
#include

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

for (int j=1;j
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The definition of main function would be:

int main(int argc,char **argv)

create a function that would do the copy file part

then call the function in loop.


example:
int main(int argc, char **argv)
{
 for(int i=0;i<argc;i++)>
 {
  function_to_copy(argv[i],copied_path);
 }
}
  Permalink  

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

  Print Answers RSS
0 Peter Leow 115
1 Frankie-C 115
2 OriginalGriff 113
3 Afzaal Ahmad Zeeshan 85
4 Richard MacCutchan 85
0 OriginalGriff 933
1 Sergey Alexandrovich Kryukov 740
2 Abhinav S 573
3 F-ES Sitecore 420
4 Dave Kreskowiak 419


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 15 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100