I just tried your code and it does create the file as well overwrites it if run repeatedly.
what do you mean C++ is running in admin mode?
if your built binary is in system path then you need to run your binary as admin/root not C++ compiler.
If you are using Visual Studio then check the path of "Working Directory" under "Debugging" property in the property pages of your project.
Your file will be created in that directory