Calling an .exe file

I am trying to make a file that checks if a text file is present. If it is then it calls one .exe and if it doesn't exist then it creates that file. How would I check and then call the appropriate .exe?
How would I check ...
1
2
3
4
if(ifstream("C:\\path\\to\\file.txt"))
   // file exists and can be opened for reading by the program
else
   // file doesn't exist or can't be opened for reading by the program (maybe violation security) 

It uses only standart C++ abilities. To know for sure if the file exists or not, you should use some API-functions, which depend on OS. To call .exe program it's necessary to call these functions, because it's not supported by standart. See this: http://msdn.microsoft.com/en-us/library/bb762153(v=vs.85).aspx (for Windows).
Topic archived. No new replies allowed.