티스토리 뷰


#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <tchar.h>

int _tmain(INT32 argc, LPTSTR argv[])
{
// MAX_PATH : The maximum character length of a path.
TCHAR currentDirectory[MAX_PATH];
TCHAR windowsDirectory[MAX_PATH];
TCHAR systemDirectory[MAX_PATH];

// GetCurrentDirectory GetWindowsDirectory GetSystemDirectory
// If the function fails, the return value is zero.

DWORD result1 = GetCurrentDirectory(MAX_PATH, currentDirectory);
if (result1 != 0)
_tprintf(_T("Current Directory \t %s \n"), currentDirectory);

DWORD result2 = GetWindowsDirectory(windowsDirectory, MAX_PATH);
if (result2 != 0)
_tprintf(_T("Windows Directory \t %s \n"), windowsDirectory);

DWORD result3 = GetSystemDirectory(systemDirectory, MAX_PATH);
if (result3 != 0)
_tprintf(_T("System Directory \t %s \n"), systemDirectory);

return EXIT_SUCCESS;
}

/* Output
Current Directory C:\Source\VisualStudio\System1\System1
Windows Directory C:\Windows
System Directory C:\Windows\system32
*/


'Piece' 카테고리의 다른 글

[Python] Check Package Dependencies  (0) 2018.06.30
[C] struct Initialization  (0) 2018.06.25
Array [C# Java] 1 Dimensional Array Initialization  (0) 2018.06.24
switch [C# C++ Java] fall through  (0) 2018.06.24
Built-In Fundamental Primitive Data Types  (0) 2018.06.20
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
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
글 보관함