sqlparser/file.cpp
// Get the size of the file
Get the size of the file
Get the size of the file
int File::GetFileSize(const char* file)
{
	int size = -1;
	if(file == NULL)
		return -1;
#ifdef WIN32
	struct _finddata_t fileData;
	int findHandle = _findfirst(file, &fileData); 
	if(findHandle == -1)
	{
		return -1;
	}
	size = (int)fileData.size;
	_findclose(findHandle);
#else
	struct stat info;
	if(stat(file, &info) != -1)
	{
		if(S_ISREG(info.st_mode))
 			size = info.st_size;
	}
#endif
	return size;
}
int File :: GetFileSize ( const char * file ) { int size = -1 ; if ( file == NULL ) return -1 ; #ifdef WIN32 struct _finddata_t fileData ; int findHandle = _findfirst ( file , & fileData ) ; if ( findHandle == -1 ) { return -1 ; } size = ( int ) fileData . size ; _findclose ( findHandle ) ; #else struct stat info ; if ( stat ( file , & info ) != -1 ) { if ( S_ISREG ( info . st_mode ) ) size = info . st_size ; } #endif return size ; }
Get the size of the file
Get the size of the file
// define the file size to allocate buffer // Check that the file was found