I have a Windows API task: "Define and output the current directory for the process and for each disk."
Did I understand correctly and complete the task? What does it mean for each disc?
void get_current_dir(TCHAR dirname[]) { TCHAR *fileExt = NULL; TCHAR szDir[MAX_PATH]; GetFullPathName(dirname, MAX_PATH, szDir, &fileExt); _tprintf(_T("Full path: %s \nFilename: %s\n"), szDir, fileExt); } int main () { TCHAR dirname[] = TEXT("C:"); get_current_dir(dirname); } UPD:
It seems to figure out how to get the current directory of the current disk.
void get_current_process_dir() { char* buffer = new char[MAX_PATH]; GetCurrentDirectoryA(MAX_PATH, buffer); CharToOemA(buffer, buffer); cout << buffer << endl; }