File.c (499B)
1 2 int EGong_file_open(char *path, ...vargs){ 3 int sock=open(path,vargs); 4 if(sock<0){ 5 do_log_call_composite(LOG_COMPOSE_SRC, LOG_TYPE_SIGNAL, LOG_LEVEL_ERROR, "Couldn't open file \"", path, "\"", NULL); 6 } 7 return sock; 8 } 9 10 int FileExists(const TCHAR *fileName){ 11 #ifdef _WIN32 12 DWORD fileAttr; 13 fileAttr = GetFileAttributes(fileName); 14 if(fileAttr==0xFFFFFFFF) 15 return 0; 16 #else 17 if(access("file", F_OK)!=0) 18 return 0; 19 #endif 20 return 1; 21 } 22 23 void EGong_file_close(int file){ 24 close(file); 25 }