c++ - How to open and read files in a Windows Universal App using fopen -


i'm writing windows app (non-xaml) in c++ , trying read files in project directory using:

file* mfile = fopen(filename, "rb"); 

and tried:

errno_t err = fopen_s(&mfile, filename, "rb"); 

in case, errno 2 , in both cases mfile null afterwards.

i'm having trouble finding c++ code explains how open , read files. filename such: "./adirectory/anotherdirectory/thefile"

my solution directory looks lot of things omitted:

  • appname.shared
  • appname.windows

    adirectory

      anotherdirectory

        thefile
  • appname.windowsphone

i've seen called filepicker in api looks little excessive , has more ui need.

what appropriate way include files project , load them in windows runtime?

i found fix. turns out "directories" in project structure not actual directories, , in visual studio "filters." if made path "thefile" instead of ""./adirectory/anotherdirectory/thefile," fopen work.


Comments