In a project derived from the DirectX12 template, I am trying to append text to a log file. If I try this, the error codes tell me I don't have file permission. It works fine with my game brought in from an older version of Visual Studio and DirectX10 (but of course the DirectX didn't work), so it may be an item in the project properties that I need to change.
My question is: in code derived from the DirectX12 App template, what do I need to do to append text to a log file?
I am using Microsoft Visual Studio Community 2019 Version 16.11.9.
What I have tried:
I created a new project, using the template 'DirectX12 App (Universal Windows - C++/CX)'. I added these lines to the start of
err = fopen_s(&log, "C:\\Users\\msdk\\Documents\\log.txt", "a");
if (log != NULL)
fputs("Start of logging\n", log);
This should create the file log.txt
in my Documents
folder, but when the
is set to 13 ('no file permission'), and log is NULL.
This code works with some other templates, so that makes me think the problem is a feature of the 'DirectX12 App (Universal Windows - C++/CX)' template. I just can't figure out where to find what's missing.