Created
December 12, 2023 18:27
-
-
Save Sohamkadam333/fdd3ca64ab697aeb7a6377ec35aba951 to your computer and use it in GitHub Desktop.
Retrieves the path of the system directory. The system directory contains system files such as dynamic-link libraries and drivers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
TCHAR systemDirectory[MAX_PATH]; | |
DWORD result = GetSystemDirectory(systemDirectory,MAX_PATH); | |
if(result !=0) | |
{ | |
_tprintf(_T("System Directory %s\n"),systemDirectory); | |
} | |
else | |
{ | |
cout<<"Error getting systemDirectory, Error no: "<<GetLastError()<<endl; | |
} | |
system("PAUSE"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment