PDA

View Full Version : Find Directory where OS is installed



Dilshad
7th February 2012, 13:29
Hi,
Could anyone please help me find theDirectory where the OS is installed using Qt 4.7.4.
The OS is Windows7.
Appreciate your help.
Thanks in advance.

wysota
7th February 2012, 13:35
You can try with

qgetenv("SystemRoot")

or

qgetenv("WinDir")

KillGabio
7th February 2012, 13:39
Try using QDir..check the documentation. There is a function (actually a few) that can provide you with useful information like:

QDir QString Return Value
current() currentPath() The application's working directory
home() homePath() The user's home directory
root() rootPath() The root directory
temp() tempPath() The system's temporary directory

hope it helps

Dilshad
7th February 2012, 14:41
Thanks. Will try it out.
Just one more doubt. Can we get a list of the number of directories present?
I was looking through and got to know that QDir:irs might do the trick, but am not so sure about it.