none
File open fails with permission denied error(fopen())

    Domanda

  • Hi,

    I am developing WinRT c++ component and from the component  i am trying to open a file on harddisk .

    But I got an error-permission denied.

    so how to use a harddik file from runtime component?

    thanks,

    Bhash

    mercoledì 18 aprile 2012 18:18

Risposte

  • Hi Bhash,

    Metro style apps do not have permissions to most of the file system, only to files within their install location and application data store. You should be able to use fopen in those locations, but not elsewhere.

    You can get limited access to the various libraries (Documents, Music, Photos, etc.) by declaring the appropriate Capabilities, but that access needs to come through the StorageFolder and StorageFile classes. Since your process doesn't have permission to read these files a broker process will open them for you and provide their contents as a stream.

    The user can grant your app access to other files on the system by choosing them in a file picker. This access would also be brokered and provided via the StorageFolder and StorageFile classes.

    --Rob

    mercoledì 18 aprile 2012 21:10
    Proprietario