title: How to check whether a file exists in C:\ drive using VC++?
body: <p>I want to check a file is present in C drive or not..? can any one tell me how ?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I got errors, I am using VC++ 2008</p>
  
  <pre><code>#include "stdafx.h" 
  #include &lt;stdio.h&gt; 
  int main(int argc, _TCHAR argv[]) 
  { 
      FILE * f = fopen("C:\\Program Files (x86)\\flower.jpeg"); 
      if (f == NULL) { 
          file_exists = FALSE:
      } else { 
          file_exists = TRUE; 
          fclose(f);
      } 
      return 0;
  }
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>When trying to cut and paste code from the <a href="http://msdn.microsoft.com/en-us/library/bb773584(VS.85).aspx" rel="nofollow noreferrer">linked example</a> below:</p>
  
  <pre><code>#include "stdafx.h" 
  #include &lt;windows.h&gt; 
  #include "Shlwapi.h" 
  int tmain(int argc, _TCHAR argv[]) 
  { 
      // Valid file path name (file is there). 
      TCHAR buffer_1[ ] = _T("C:\\TEST\\file.txt"); 
      TCHAR *lpStr1; 
      lpStr1 = buffer_1; 
  
      // Return value from "PathFileExists". 
      int retval;
  
      // Search for the presence of a file with a true result.
      retval = PathFileExists(lpStr1); 
      return 0;
  } 
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <pre><code>files.obj : error LNK2019: unresolved external symbol __imp__PathFileExistsW@4 referenced in function _wmain 
  </code></pre>