function to return the windows installed drive?
i would like to know the function which returns the drive where the windows has been installed. for example if we 开发者_Go百科run a program with following code in windows which is installed in "C:\" temp_char = getWindowsInstalledDrive();
should return "C:\".
please point me to that function if you know. it should be a C/C++ function. Thanks.
You can use GetSystemDirectory(): http://msdn.microsoft.com/en-us/library/ms724373%28VS.85%29.aspx and then take the first 3 letters.
Use GetWindowsDirectory, and then extract the drive from the first three characters. This function is described as "legacy" in the help, but should work on all existing Windows versions.
精彩评论