わびさびサンプルソース

WindowsやHTML5などのプログラムのサンプルコードやフリーソフトを提供します。

Windowsのシステムフォルダを取得する

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






わびさびサンプルソース

WindowsやHTML5などのプログラムのサンプルコードやフリーソフトを提供します。