title: Debugging C program with two arguments passed
body: <p>I have fixed some syntactical errors in my code and now the program compiles fine. But when I execute the program the outputFile is empty. outputFile should have contents of inputFile in reverse order. I am trying to debug code in <code>CodeLite</code> IDE.</p>
  
  <p>I need to debug the code with two arguments passed (inputFile and outputFile). I don't seem to find that option in <code>CodeLite</code> IDE. How do I do that ?</p>
  
  <pre><code>#include &lt;fcntl.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  
  
  #define BUFFER_SIZE 256
  int main (int argc, char *argv[]){
      FILE  *inputFile, *outputFile; 
      int fileSize;
      int pointer;
      char buffer[BUFFER_SIZE];
  
      /* Check for correct user's inputs. */
      if( argc !=3 ) {
          fprintf(stderr, "USAGE: %s inputFile outputFile.\n", argv[0]);
          exit(-1);
      }
  
      /* Make sure input file exists. */
      if( (inputFile = fopen(argv[1], O_RDONLY))) {
          fprintf(stderr, "Input file doesn't exist.\n"); 
          exit(-1);
      }
  
      /* Create output file, if it doesn't exist.  Empty the file, if it exists. */
  
      if((outputFile = fopen(argv[2], "a+"))) {
          fclose(inputFile);
          exit(-1);
       }
  
  
      /* Find the size of the input file. */
      fileSize = fseek(inputFile, 0, SEEK_END);
  
  
      /* Read input file and write to output file in reversed order.*/
  
      for(pointer=fileSize-1; pointer&gt;=0; pointer--) {
  
  
      /*Write content in the buffer to the output file */
  
          while(!feof(inputFile))
          {
              fgets(buffer, BUFFER_SIZE, inputFile); //reads 256 bytes at a time
              fputs (buffer , outputFile );
          }
  
      }
  
      fclose(inputFile);
      fclose(outputFile);
  
      return(0);
  } 
  </code></pre>