title: Word Mincing program
body: <p>This is the program requirements as of current below:</p>
  
  <p>Please write a C program which accepts a command line from the user via the console,
  consisting of three file names, two input files and one output file. All three are text files. You can
  use the file extension .txt.
  Your program should open the first two files for input and the third file for output. Diagnose and
  thoroughly test code provisions for informatively diagnosing any failed file opening.
  Then, your program should read one line each from each file until reaching and end of file. For
  each line, transfer one word from each line, merging them together to form an output line.
  Capitalize the first letter of each word from the first file and the last letter of each word from the
  second file until you exhaust one line. Transfer all remaining words from the longer line to your
  output line unchanged. At the end of each set of lines end with a period and write a line to the
  output file. If one file ends before the other simply transfer the remaining lines to your output file
  unchanged. Print counts showing what your program processed.
  For example, if two lines were:
  “Now is the time.”
  “For the quick brown fox.”
  Then your output line would be:
  “Now foR Is thE The quicK Time browN fox.”</p>
  
  <p>This is the program requirements that I need help with</p>
  
  <p>thank you to anyone who can/has helped so far</p>
  
  <pre><code>/* 
  *   Copyright (C) 2018 Canton Robinson
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
  *   the Free Software Foundation, either version 3 of the License, or
  *   (at your option) any later version.
  *
  *   This program is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
  */
  #include &lt;stdio.h&gt; 
  #include &lt;stdlib.h&gt; 
  #include &lt;ctype.h&gt;
  int main( int argc, char *argv[] ) 
  { 
   FILE *fp1 , *fp2, *fp3;
   int ch1, ch2, lch2;
   //int s;
   //int count1=0 , count2=0;
  
    if (argc !=4) {
          fprintf(stderr, "Usage: mincers File1 File2 destFile\n");
          exit(EXIT_FAILURE);
      }
  
   if ((fp1 = fopen(argv[1], "rb")) ==NULL) {
              fprintf(stderr, "Can't open %s\n", argv[1]);
              exit(EXIT_FAILURE);
          }
  
           if ((fp2 = fopen(argv[2], "rb")) ==NULL) {
              fprintf(stderr, "Can't open %s\n", argv[2]);
              exit(EXIT_FAILURE);
          }
  
    if ((fp3 = fopen(argv[3], "wb")) ==NULL) {
              fprintf(stderr, "Can't open %s\n", argv[3]);
              fclose(fp1);
              fclose(fp2);
              exit(EXIT_FAILURE);
          }
  
     // Copy contents of first file to file3.txt 
     //while ((ch = fgetc(fp1)) != EOF) 
      //  fputc(ch, fp3); 
  
     // Copy contents of second file to file3.txt 
    // while ((ch = fgetc(fp2)) != EOF) 
       // fputc(ch, fp3);
      //       while((s = fgetc(fp1)) != EOF) {
       //   if(s == ' ')  count1++;
     // }
     // while((s = fgetc(fp2)) != EOF) {
      //    if(s == ' ') count2++;
     // }
  
      while(isspace(ch1=fgetc(fp1)));
      while(isspace(ch2=fgetc(fp2)));
  
      while(ch1!=EOF || ch2!=EOF) {
      if(ch1!=EOF) {
          fputc(toupper(ch1), fp3);
          while((ch1=fgetc(fp1))!=EOF &amp;&amp; !isspace(ch1))
              fputc(ch1, fp3);
          fputc(' ', fp3);
          while(isspace(ch1))
              ch1=fgetc(fp1);
      }
      if(ch2!=EOF) {
          //fputc(tolower(ch2), fp3);
          for(lch2=ch2; (ch2=fgetc(fp2))!=EOF &amp;&amp; !isspace(ch2); lch2=ch2)
              fputc(lch2, fp3);
          fputc(tolower(lch2), fp3);
          fputc(' ', fp3);
          while(isspace(ch2))
              ch2=fgetc(fp2);
      }
  } 
  
     printf("Merged %s and %s into %s", argv[1], argv[2], argv[3]); 
  
     fclose(fp1); 
     fclose(fp2); 
     fclose(fp3); 
  
    // printf("%d , %d\n", count1, count2);
     return 0; 
  } 
  </code></pre>