Find File API.

xiaoxiao2021-03-06  14

/ * ffapi.h * /// * Find file api. Copyright (c) 2004 by Troels K. * /

#ifndef __ffapi_h __ # define __ffApi_h__

#ifndef isslash #define isslash ((((c) == '/') || ((c) == '//') # ENDIF

#ifndef extern_c #ifdef __cplusplus #define extern_c extern "C" #Else #define extern_c extern # Endif # Endif

#ifdef _WIN32 struct _finddata_t; struct _wfinddata_t; #elif _MSDOS struct _find_t; #define _finddata_t _find_t # else / * posix * / #define _MAX_PATH 260 #define _A_NORMAL 0x00 #define _A_RDONLY 0x01 #define _A_HIDDEN 0x02 #define _A_SYSTEM 0x04 #define _A_SUBDIR 0x10 #define _A_ARCH 0x20 struct _wfinddata_t; #ifndef TCHAR #ifdef _UNICODE #define TCHAR wchar_t #else #define TCHAR char #endif #endif #ifndef _FINDDATA_T_DEFINED #include #ifndef _FSIZE_T_DEFINED typedef unsigned long _fsize_t; / * Could be 64 bits for Win32 * / #define _FSIZE_T_DEFINED #endif struct _finddata_t {unsigned attrib; time_t time_create; / * -1 for FAT file systems * / time_t time_access; / * -1 for FAT file systems * / time_t time_write; _fsize_t size; char name [260];}; struct _wfinddata_t {unsigned attrib; time_t time_create; / * -1 for FAT file systems * / time_t time_access; / * -1 for FAT file systems * / time_t time_write; _fsize_t size; wchar_t name [260];}; #ifdef _UNICODE #define _tfinddata_t _wfinddata_t #else #define _tfinddata_t _finddata_t #endif #define _finddata_t_defined # Endif / * POSIX * /

#ENDIF

struct _FFIMPLA; typedef struct _FFIMPLA * FFHANDLEA; typedef struct _FFAPIA {FFHANDLEA (* open) (void * filesystem, const char * dir, struct _finddata_t *); int (* next) (FFHANDLEA, struct _finddata_t *); void (* close (Ffhandlea *); void * filesystem;} ffapia;

EXTERN_C VOID FILL_HOST_FILEFIND (FFAPIA *); Extern_C INT HOST_STAT (Const Char * file, struct _finddata_t *);

#if defined (_wchar_t_defined) &&! defined (_MSDOS)

Struct _ffimplw; typedef struct _ffImplw * ffhandlew;

typedef struct _FFAPIW {FFHANDLEW (* open) (void * filesystem, const wchar_t * dir, struct _wfinddata_t *); void (* close) (FFHANDLEW *);; (* next) (FFHANDLEW, struct _wfinddata_t *) int void * filesystem FFAPIW;

EXTERN_C void fill_host_filefindw (FFAPIW *); EXTERN_C int host_statw (const wchar_t * file, struct _wfinddata_t *); EXTERN_C void mbstowcs_finddata (struct _wfinddata_t *, const struct _finddata_t *); EXTERN_C void wcstombs_finddata (struct _finddata_t *, const struct _wfinddata_t *);

#ENDIF

#if defined (UNICODE) || defined (_UNICODE) #define FFHANDLE FFHANDLEW #define tfill_host_filefind fill_host_filefindw #define thost_stat host_statw # else #define FFHANDLE FFHANDLEA #define tfill_host_filefind fill_host_filefind #define thost_stat host_stat # endif

#ifndef ffapi #if Defined (unicode) || Defined (_Unicode) #define ffapi struct _ffapiw #else #define ffapi struct _ffapia # Endif # Endif

#ENDIF / * __FFAPI_H__ * /

转载请注明原文地址:https://www.9cbs.com/read-48568.html

New Post(0)