title: How to check if a file exist to open in a exe C++
body: <p>I have a button that opens a file in a exe, what I would like to do is check to make sure this file exist before starting the exe. How could I accomplish this? Any help would be greatly appreciated.</p>
  
  <p>I am a tad rusty on my C++ and this is a legacy application using C++ 6.0 
  and windows xp...</p>
  
  <p>here is my code ..</p>
  
  <pre><code>void CJunkView::OnCadkeyButton() 
  
    { 
       CString year = "Desktop";
       CString fileName = "x.prt";
       CString fileToOpen = "\"C:\\Documents and settings\\Administrator\\" + year +"\\" + fileName + "\"";
       CString exePath = "\"C:\\CK19\\Ckwin.exe\"";
       CString cmd = "start " + exePath + ", " + fileToOpen;
       system (cmd.GetBuffer(cmd.GetLength() + 1));
  
    }
  </code></pre>