티스토리 뷰
#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 |