[DllImport("kernel32.dll", SetLastError = true)]
static extern bool GetDiskFreeSpaceEx(
string lpDirectoryName,
out ulong lpFreeBytesAvaliable,
out ulong lpTotalNumberOfBytes,
out ulong lpTotalNumberOfFreeBytes);
// Returns free disk space from directory.
public static ulong GetFreeDiskSpace(string directory)
{
ulong a, b, c;
if (GetDiskFreeSpaceEx(directory, out a, out b, out c))
{
Debug.WriteLine(a);
}
return a;
}
我正在開發Windows應用商店應用。爲什麼一個變量在我打電話時包含0:使用C獲取WinRT中的可用磁盤空間#
GetFreeDiskSpace("C:\\");
?
Debug.WriteLine(a)的行未被執行。
我使用filepicker來可以訪問這些文件,但是當我運行獲取可用空間的函數時,似乎工作的唯一文件夾是「ApplicationData.Current.LocalFolder」 – 2013-07-10 13:27:41