poojakz
poojakz

Reputation: 47

Get the directory in c++

I want to get the "C:\WINDOWs" path if the operating system is on the another drive then "E:\WINDOWS". I used getenv("windir"), but i dont want this solution. what if i change the name of my environment variable.variable

Upvotes: 1

Views: 713

Answers (2)

jcoder
jcoder

Reputation: 30035

The API SHGetFolderPath passing in CSLID_WINDOWS looks like what you need.

Upvotes: 0

Geoffrey
Geoffrey

Reputation: 11353

See windows API GetWindowsDirectory

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724454(v=vs.85).aspx

Upvotes: 3

Related Questions