Waiting for file availability
Is there any portable way to wait until a file becomes available (assuming it exists)? For example, I thought of this:
Of course, speaking of portability, the contents of system() are not. Still, then I realized how inefficient my method waswas. Something more along the lines of this was in order:
//assuming some other app is using "file"...
//wait until "file" is available, then delete it
while( !std::fstream("file") );
But then Sleep() is not portable! Am I out of luck? Is this os-specific?
while( !std::fstream("file") ) //check every 5 seconds