Windows C++ 로 시스템 DISK 사용률 출력하기

프로그래밍/C, C++|2021. 4. 22. 09:33
반응형

BOOL  fResult;

unsigned __int64 i64FreeBytesToCaller,

    i64TotalBytes,

    i64FreeBytes;

fResult = GetDiskFreeSpaceEx(L"C:",

    (PULARGE_INTEGER)&i64FreeBytesToCaller,

    (PULARGE_INTEGER)&i64TotalBytes,

    (PULARGE_INTEGER)&i64FreeBytes);

if (fResult)

{

    printf("Available space to caller = %I64u MB\n",

        i64FreeBytesToCaller / (1024 * 1024));

    printf("Total space               = %I64u MB\n",

        i64TotalBytes / (1024 * 1024));

    printf("Free space on drive       = %I64u MB\n",

        i64FreeBytes / (1024 * 1024));

}

 

[출처] https://stackoverflow.com/questions/11917946/how-do-i-get-available-disk-space-from-windows-using-c

반응형

댓글()