GetCurrentDirectory

; 실행중인 파일의 현재 작업 디렉토리 얻어오기.

 
#include <stdio.h> 
#include <windows.h>
 
DWORD WINAPI GetCurrentDirectory(DWORD nBufferLength, LPTSTR IpBuffer)
 
----------
 
int main()
{
    char strPath[MAX_PATH];
    GetCurrentDirectory(MAX_PATH, strPath);

    printf("%s\n", strPath); 
 
    return 0;
}
cs

 

GetModuleFileName

; 자신의 실행 경로 받아오기.

 
#include <stdio.h> 
#include <windows.h>
 
DWORD WINAPI GetModuleFileName(HMODULE hModule, LPSTR IpFileName, DWORD nSize)
 
----------
 
int main()
{
    char strPath[MAX_PATH];
    GetModuleFileName(NULL, Path, MAX_PATH);
 
    printf("%s\n", strPath); 
 
    return 0;
}
cs

'::public > C++' 카테고리의 다른 글

byte padding(바이트 패딩)  (0) 2023.01.18
(C++11) chrono  (0) 2023.01.04
GetTickCount, GetTickCount64  (0) 2021.06.04
MSB8020 에러  (0) 2021.01.06
noexcept  (0) 2020.12.14

+ Recent posts