# File access in UWP?

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

## 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;
fs.open(filename, std::fstream::in | std::fstream::binary);

if (!fs.is_open())
{
return 0;
}

fs.seekg(0, std::ios::end);
int nSize = (int)fs.tellg();
char* memblock = new char[nSize];
fs.seekg(0, std::ios::beg);
fs.close();


##### 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

• 23
• 10
• 19
• 15
• 14