title: How to check whether file exists in Qt in c++
body: <p>How do I check whether a file exists in a given path or not in Qt?</p>
  
  <p>My current code is below:</p>
  
  <pre><code>QFile Fout("/Users/Hans/Desktop/result.txt");
  
  if(!Fout.exists()) 
  {       
    eh.handleError(8);
  }  
  else
  {
    // ......
  }
  </code></pre>
  
  <p>But when I run the code it is not giving the error message specified in <code>handleError</code> even though the file I mentioned in the path does not exist.</p>