Windowsのインストールフォルダを取得するには、GetWindowsDirectory関数 を呼び出します。
#include <tchar.h>
#include <iostream>
#include <windows.h>
/*
Windowsのインストールフォルダを取得する
*/
int _tmain
(
int argc
, _TCHAR* argv[]
)
{
// 標準出力にユニコード出力する
setlocale( LC_ALL, "Japanese" );
TCHAR waBuf[ MAX_PATH ];
// Windowsインストールフォルダの取得
::GetWindowsDirectory( waBuf, _countof( waBuf ) );
std::wcout << L"■Windowsインストールフォルダ" << std::endl;
std::wcout << waBuf << std::endl;
// 正常終了
return( 0 );
}
■Windowsインストールフォルダ
C:\WINDOWS