我想使用GetDiskFreeSpace()
函數,但我需要rootpathname。給定任何文件名輸入我可以使用哪個函數來查找其卷路徑名稱?如何找到根路徑名稱
我的功能,在命令行中輸入得到:
string targetFile;
cin.sync();
cin.clear();
cout << "Enter target file " << endl;
getline(cin, targetFile);
//if statement error handler for targetFile
fstream file(targetFile.c_str());
if (!file)
{
cout << "File does not exist" << endl;
}
file.close();
尋求調試幫助的問題(「爲什麼這個代碼不工作?」)必須包含所需的行爲,特定的問題或錯誤以及在問題本身中重現問題所需的最短代碼。沒有明確問題陳述的問題對其他讀者無益。請參閱:如何創建最小,完整和可驗證示例。 –
調用'GetDiskFreeSpaceEx':*此參數不必指定磁盤上的根目錄。該函數接受磁盤上的任何目錄* –
嗯,我試圖找出任何文件的卷的大小(以字節爲單位)使用GetDiskFreeSpace – dspaces1