开发者

function to return the windows installed drive?

开发者 https://www.devze.com 2022-12-20 03:30 出处:网络
i would like to know the function which returns the drive where the windows has been installed. for example

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号