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