Advertisement Jump to content
Sign in to follow this  

File access in UWP?

This topic is 708 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,


I am extremely close to porting my game framework over to UWP (from Win32). Everything is compiling and working well, but I have come across a minor hurdle.


I have a function that loads model data which gets stored away for DirectX to use later on. But for some reason, I can't get the application to find the file (even if I hard code the path), yet the original Win32 based project sees and loads the files fine.


The following function loads the model file. 


int obj_sun = Game.objectCreate("E:\\media\\sun.dat");


// The section of code that loads the file
std::ifstream fs;, std::fstream::in | std::fstream::binary);
if (!fs.is_open())
_systemError("File not found");
return 0;
fs.seekg(0, std::ios::end);
int nSize = (int)fs.tellg();
char* memblock = new char[nSize];
fs.seekg(0, std::ios::beg);, nSize);

Share this post

Link to post
Share on other sites

Yeah, I thought it would be a sandbox thing which made sense. Was actually looking at the same link too, but didn't give the actual answer on it.


Just worked it out right this minute. 


Right Click on Assets -> Add Existing Item -> Select the file

Right Click on the new 'Asset' -> Properties

  • Excluded from build - No
  • Content - Yes
  • Item Type - Does not participate in build
Edited by DarkRonin

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!