QUOTE(Xing @ 24 Sep, 2006 - 10:04 AM)

That's not possible through standard C++. You will need to use external library for that.
That is obvious...any OS specific feature can be implemented only using external libraries.
Since he asked specifically for Windows, I don't think he is writing his application for multiple platforms.
So portability doesn't have much importance here.
QUOTE(sajadkk @ 24 Sep, 2006 - 08:56 AM)

How can i detect windows folder automaticaly using c++?
that is i want to detect windows folder and want to store a file int it using c++,please help me.
You can use the GetWindowsDirectory API Function defined in windows.h like this:
CODE
char s[255];
GetWindowsDirectory(s,255);
After the function call, s will contain the path of the Windows Directory.
Here's the Function Prototype Information about this API Function:
QUOTE
UINT GetWindowsDirectory(
LPTSTR lpBuffer, // address of buffer for Windows directory
UINT uSize // size of directory buffer
);
Parameters
lpBuffer
Pointer to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the Windows directory is the root directory. For example, if the Windows directory is named WINDOWS on drive C, the path of the Windows directory retrieved by this function is C:\WINDOWS. If the system was installed in the root directory of drive C, the path retrieved is C:\.
uSize
Specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. This value should be set to at least MAX_PATH to allow sufficient room in the buffer for the path.
(Source) : MSDN