locked
Accessing files in Picture Library using std::fstream in Windows Store Apps?

    Question

  • If my app declares access to Picture Library, can I use fstream to open files in that folder? I passed the absolute path and it didn't work. Am I out of luck and stuck with WinRT APIs? I want to make the code as platform independent as possible.
    Friday, March 14, 2014 10:17 PM

Answers

All replies

  • You'll need to use Windows Runtime API. Your app doesn't have direct access to folders outside of its install and app data folders. It can only access other folders via the StorageItem brokers.

    I discussed this in my blog entry Skip the path: stick to the StorageFile . You can use StorageFiles to open a stream to the file contents and then pass the stream to your platform independent code.

    Saturday, March 15, 2014 12:08 AM
    Owner
  • Thanks. How about IWICImagingFactory::CreateDecoderFromFilename() function? It doesn't take a general file path either. What options do I have if I want to render a picture in the picture library using directx api?
    Tuesday, March 18, 2014 12:30 AM
  • Same thing. You have access to the libraries only through the StorageFile and StorageFolder objects.

    --Rob

    Tuesday, March 18, 2014 5:46 AM
    Owner