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:Code://assuming some other app is using "file"... //wait until "file" is available, then delete it while( !std::fstream("file") ); std::system("del file");
But then Sleep() is not portable! Am I out of luck? Is this os-specific?Code:while( !std::fstream("file") ) //check every 5 seconds { Sleep(5000); } std::system("del file");