hi, 
 
the below attached program uses the argument command line the copy a file to 
another file. my question is what can I change in   the program to make only 
part of the first file be copied to the second.
 
#include<stdio.h>
int main(int argc, char *argv[])
{
  FILE *inFilePtr;   /*input file pointer*/
  FILE *outFilePtr;   /*output fole pointer*/
  int c,i;
  /*check number of command-line arguments */
  if(argc != 3){
    printf("Usage: mycopy infile outfile\n");} /*end if*/
    else /*if input file can be opened*/
      {
        if((inFilePtr=fopen(argv[1],"r"))!=NULL)  /*if input file can be 
opened*/
         { if((outFilePtr =fopen(argv[2], "w")) != NULL) /*if output file can 
be opened*/
            {while((c = fgetc(inFilePtr)) !=EOF) /*read and output characters*/
              {
            fputc(c,outFilePtr);}/*end while*/
          }/*end if*/
        else /*output file could not be opened*/
          {printf("File\"%s\" could not be opened\n", argv[2]);
          } /*end else*/
      }/*end if*/
    else /*input file could not be opened*/
    {  printf("File\"%s\" coulk not be opened\n", argv[1]);}  /*end else*/
              } /*end else*/
     return 0; /*indicates successful termination*/
     }/*end main*/



      Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/

[Non-text portions of this message have been removed]

Reply via email to