forked from lutaf/uploadfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSysUtil.cpp
More file actions
24 lines (24 loc) · 749 Bytes
/
SysUtil.cpp
File metadata and controls
24 lines (24 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "SysUtil.h"
//-----------------------------------------------------------------
DWORD GetSizeOfFile(LPCTSTR FileName)
{
WIN32_FIND_DATA FindData;
HANDLE h= FindFirstFile(FileName, &FindData);
if (h != INVALID_HANDLE_VALUE )
{
FindClose(h);
//Îļþ±ØÐë < 4G
return FindData.nFileSizeLow;
}else
return 0;
}
//-----------------------------------------------------------------
bool IsDirExist(const char *dir){
DWORD ret = GetFileAttributesA(dir);
return ((ret!=INVALID_FILE_ATTRIBUTES)&&(ret&FILE_ATTRIBUTE_DIRECTORY)!=0);
}
//-----------------------------------------------------------------
bool IsFileExist(const char *dir){
DWORD ret = GetFileAttributesA(dir);
return ret!=INVALID_FILE_ATTRIBUTES;
}