title: How to check if a file has content or not using C?
body: <p>I have a source file <code>file1</code> and a destination file <code>file2</code>, here I have to move content from  <code>file1</code> to <code>file2</code>. </p>
  
  <p>So I have to do some validation first. </p>
  
  <ol>
  <li><p>I must check source file is existing or not?
  I can check using this: </p>
  
  <pre><code>fp = fopen( argv[1],"r" );
  if ( fp == NULL )
  {
      printf( "Could not open source file\n" );
      exit(1);
  } 
  </code></pre></li>
  <li><p>Then I have to check if the source file has any content or not? If it is empty, I have to throw some error message.</p></li>
  </ol>
  
  <p>This is what I've tried until the moment.    </p>