わびさびサンプルソース

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

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

Windowsのシステムフォルダを取得するには、GetSystemDirectory関数 を呼び出します。

Windowsのシステムフォルダを取得する
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#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などのプログラムのサンプルコードやフリーソフトを提供します。