Reputation: 153
I am porting a win32 dll c++ code to UWP. I want to check a file is exist in a target folder and then do something. But UWP file API is Async API, is there any workaround method to call these Async API as a synchronic API?
for example: In win32 code:
void test()
{
if(file.isExist())
{
doSomething();
}
}
Upvotes: 0
Views: 332
Reputation: 12019
Yes, UWP supports low-level Win32 APIs like CreateFile2
, ReadFile
and WriteFile
in addition to CRT functions like fopen
and STL objects like fstream
.
Note that access to file locations outside of your container will be blocked when using these APIs, although that is changing with the "RS4" release of Windows 10 (I don't know the consumer name yet). See this Channel 9 video for more information on the broadFileSystemAccess
capability.
Upvotes: 1