I would like to write code that does the following:
1) Open a file (for writing), creating the file if it doesn't exist.
2) Ensure the file exists while running some other code (by holding the file open).
3) Close the file, and delete the file if it was created during step 1.
Do any of the POSIX/C++17 stdlib/boost filesystem functions make this easy?
NOTE: A solution which involves multiple open
calls and gives invalid results if the file is created/deleted between them is not one I want.