【发布时间】:2017-01-01 05:17:12
【问题描述】:
我正在将现有的 C/C++ 应用程序移植到使用 fopen()/fclose() 的 UWP。在Win32上,我曾经使用以下两个函数来获取app资源的路径(只读),以及获取app存储的路径(读/写):
char resourcePath[2048];
const char *GetResourcePath(void)
{
GetCurrentDirectoryA(sizeof(resourcePath), resourcePath);
strcat(resourcePath, "/");
return resourcePath;
}
char storagePath[2048];
const char *GetStoragePath(void)
{
GetCurrentDirectoryA(sizeof(storagePath), storagePath);
strcat(storagePath, "/");
return storagePath;
}
什么是 UWP 等效项?我似乎只能在 C# 中找到信息。 看来我可以从这个文件夹中“rb”fopen()文件,但我不能“wb”。为什么不?它是应用程序的文件夹,不是吗?
【问题讨论】:
-
您在“WB”上遇到什么错误?惯用的方法是对 uwp 使用“Windows 运行时 API”,它通过 CPP 通过modern 访问