mirror of
https://github.com/jfdelnero/HxCFloppyEmulator.git
synced 2026-07-28 04:06:36 +00:00
get file size function.
git-svn-id: svn://svn.code.sf.net/p/hxcfloppyemu/code/HxCFloppyEmulator/libhxcadaptor/trunk@1460 63fa2f70-6a9b-4bc4-b855-9c6a949b1d69
This commit is contained in:
@@ -501,7 +501,7 @@ int hxc_find_close(void* handle)
|
||||
#if defined (DEBUG)
|
||||
printf("hxc_find_close : handle:%p\n",handle);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (WIN32)
|
||||
if(handle)
|
||||
FindClose((void*)handle);
|
||||
@@ -555,3 +555,29 @@ int hxc_mkdir(char * folder)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hxc_fgetsize( FILE * f )
|
||||
{
|
||||
int cur_pos,filesize;
|
||||
|
||||
if( f )
|
||||
{
|
||||
cur_pos = ftell(f);
|
||||
if( cur_pos >= 0 )
|
||||
{
|
||||
if(fseek (f , 0 , SEEK_END))
|
||||
return 0;
|
||||
|
||||
filesize = ftell(f);
|
||||
|
||||
if( filesize < 0 )
|
||||
filesize = 0;
|
||||
|
||||
fseek (f , cur_pos , SEEK_SET);
|
||||
}
|
||||
|
||||
return filesize;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,53 +20,53 @@ typedef struct filefoundinfo_
|
||||
int size;
|
||||
}filefoundinfo;
|
||||
|
||||
int hxc_setevent(HXCFE* floppycontext,unsigned char id);
|
||||
unsigned long hxc_createevent(HXCFE* floppycontext,unsigned char id);
|
||||
int hxc_waitevent(HXCFE* floppycontext,int id,int timeout);
|
||||
void hxc_pause(int ms);
|
||||
int hxc_createthread(HXCFE* floppycontext,void* hwcontext,THREADFUNCTION thread,int priority);
|
||||
int hxc_setevent( HXCFE* floppycontext, unsigned char id );
|
||||
unsigned long hxc_createevent( HXCFE* floppycontext, unsigned char id );
|
||||
int hxc_waitevent( HXCFE* floppycontext, int id, int timeout );
|
||||
void hxc_pause( int ms );
|
||||
int hxc_createthread( HXCFE* floppycontext, void* hwcontext, THREADFUNCTION thread, int priority );
|
||||
|
||||
unsigned long hxc_createcriticalsection(HXCFE* floppycontext,unsigned char id);
|
||||
void hxc_entercriticalsection(HXCFE* floppycontext,unsigned char id);
|
||||
void hxc_leavecriticalsection(HXCFE* floppycontext,unsigned char id);
|
||||
void hxc_destroycriticalsection(HXCFE* floppycontext,unsigned char id);
|
||||
unsigned long hxc_createcriticalsection( HXCFE* floppycontext, unsigned char id );
|
||||
void hxc_entercriticalsection( HXCFE* floppycontext, unsigned char id );
|
||||
void hxc_leavecriticalsection( HXCFE* floppycontext, unsigned char id );
|
||||
void hxc_destroycriticalsection( HXCFE* floppycontext, unsigned char id );
|
||||
|
||||
/////////////// String functions ///////////////
|
||||
|
||||
#ifndef WIN32
|
||||
//void strlwr(char *string)
|
||||
#endif
|
||||
char * hxc_strupper(char * str);
|
||||
char * hxc_strlower(char * str);
|
||||
char * hxc_strupper( char * str );
|
||||
char * hxc_strlower( char * str );
|
||||
|
||||
/////////////// File functions ////////////////
|
||||
|
||||
int hxc_open (const char *filename, int flags, ...);
|
||||
|
||||
FILE *hxc_fopen (const char *filename, const char *mode);
|
||||
int hxc_fread(void * ptr, size_t size, FILE *f);
|
||||
char * hxc_fgets(char * str, int num, FILE *f);
|
||||
int hxc_fclose(FILE * f);
|
||||
int hxc_open ( const char *filename, int flags, ... );
|
||||
|
||||
FILE *hxc_fopen ( const char *filename, const char *mode );
|
||||
int hxc_fread( void * ptr, size_t size, FILE *f );
|
||||
char * hxc_fgets( char * str, int num, FILE *f );
|
||||
int hxc_fclose( FILE * f );
|
||||
int hxc_fgetsize( FILE * f );
|
||||
#ifndef stat
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
int hxc_stat( const char *filename, struct stat *buf);
|
||||
int hxc_stat( const char *filename, struct stat *buf );
|
||||
|
||||
void* hxc_find_first_file(char *folder,char *file,filefoundinfo* fileinfo);
|
||||
int hxc_find_next_file(void* handleff,char *folder,char *file,filefoundinfo* fileinfo);
|
||||
int hxc_find_close(void* handle);
|
||||
void* hxc_find_first_file( char *folder, char *file, filefoundinfo* fileinfo );
|
||||
int hxc_find_next_file( void* handleff, char *folder, char *file, filefoundinfo* fileinfo );
|
||||
int hxc_find_close( void* handle );
|
||||
|
||||
int hxc_mkdir(char * folder);
|
||||
int hxc_mkdir( char * folder );
|
||||
|
||||
char * hxc_getcurrentdirectory(char *currentdirectory,int buffersize);
|
||||
char * hxc_getcurrentdirectory( char *currentdirectory, int buffersize );
|
||||
|
||||
char * hxc_getfilenamebase(char * fullpath,char * filenamebase);
|
||||
char * hxc_getfilenameext(char * fullpath,char * filenameext);
|
||||
int hxc_getfilenamewext(char * fullpath,char * filenamewext);
|
||||
int hxc_getpathfolder(char * fullpath,char * folder);
|
||||
int hxc_checkfileext(char * path,char *ext);
|
||||
int hxc_getfilesize(char * path);
|
||||
char * hxc_getfilenamebase( char * fullpath, char * filenamebase );
|
||||
char * hxc_getfilenameext( char * fullpath, char * filenameext );
|
||||
int hxc_getfilenamewext( char * fullpath, char * filenamewext );
|
||||
int hxc_getpathfolder( char * fullpath, char * folder );
|
||||
int hxc_checkfileext( char * path, char *ext );
|
||||
int hxc_getfilesize( char * path );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user