Getting 0x8000000B with _wfopen (C++/CX)

DmiMal 1 Reputation point

I cannot open file in UWP C++ App.

  • The file is here: C:\Users\user\Documents\Some\Path\File.xml.
  • My UWP app has broadFileSystemAccess in Package.appxmanifest.
  • My app has access to file system in windows settings.

_wfopen returns nullptr and a message about 0x8000000B is written to Output window. From Windows.Storage.ApplicationData.dll or something.
What's happening? What else should I do?

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yan Gu - MSFT 2,676 Reputation points


    Welcome to Microsoft Q&A.

    Referring to the document, you need to note the broadFileSystemAccess capability works for APIs in the Windows.Storage namespace.

    In my side, I use _wfopen_s to replace _wfopen because _wfopen is deprecated and we are suggested to use _wfopen_s instead. I check the value of errno_t by using _get_error method, the result is 13 which represents Permission denied.

    We suggest you use StorageFile.GetFileFromPathAsync method under Windows.Storage namespace to get a StorageFile.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.