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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <tchar.h>
#include <stdio.h>
#include <windows.h>
void disquepret(TCHAR *d)
{
int r;
__int64 avlblspc, ttlspc, frspc;
r=GetDiskFreeSpaceEx(d, (PULARGE_INTEGER)&avlblspc, (PULARGE_INTEGER)&ttlspc, (PULARGE_INTEGER)&frspc);
if(r!=0){printf(" %I64dGO disponible", (ttlspc-frspc)/1000000000);}else{printf(" %s","Non disponible");}
}
void listerdisque()
{
TCHAR lpBuffer[500], * p;
GetLogicalDriveStrings(sizeof(lpBuffer), lpBuffer);
for(p = lpBuffer; *p != '\0'; p += 4)
{
if(GetDriveType(p)==2)
{printf("%s","Disque amovible");}
if(GetDriveType(p)==3)
{printf("%s","Disque local");}
if(GetDriveType(p)==3||GetDriveType(p)==2)
{
disquepret(p);
printf(" %s\n",p);
}
}
return ;
}
void explorerdossier()
{
HANDLE hEnt;
WIN32_FIND_DATA ent;
if ((hEnt = FindFirstFile(_T("*.*"), &ent)) != INVALID_HANDLE_VALUE)
{
do
printf("%s\n", ent.cFileName);
while (FindNextFile(hEnt, &ent));
FindClose(hEnt);
}
return;
} |
Partager