663 char *pszFullname, *pszBasename;
671 pszBasename = (
char *)
malloc(strlen(pszFilename)+5);
672 strcpy( pszBasename, pszFilename );
673 for( i = strlen(pszBasename)-1;
674 i > 0 && pszBasename[i] !=
'.' && pszBasename[i] !=
'/' 675 && pszBasename[i] !=
'\\';
678 if( pszBasename[i] ==
'.' )
679 pszBasename[i] =
'\0';
681 pszFullname = (
char *)
malloc(strlen(pszBasename) + 5);
682 sprintf( pszFullname,
"%s.dbf", pszBasename );
687 fp = psHooks->
FOpen( pszFullname,
"wb" );
695 psHooks->
FWrite( &chZero, 1, 1, fp );
698 fp = psHooks->
FOpen( pszFullname,
"rb+" );
707 sprintf( pszFullname,
"%s.cpg", pszBasename );
708 if( pszCodePage != NULL )
710 if( strncmp( pszCodePage,
"LDID/", 5 ) == 0 )
712 ldid = atoi( pszCodePage + 5 );
719 psHooks->
FWrite( (
char*) pszCodePage, strlen(pszCodePage), 1, fpCPG );
723 if( pszCodePage == NULL || ldid >= 0 )
725 psHooks->
Remove( pszFullname );
734 psDBF = (DBFHandle) calloc(1,
sizeof(DBFInfo));
736 memcpy( &(psDBF->sHooks), psHooks,
sizeof(
SAHooks) );
740 psDBF->nRecordLength = 1;
741 psDBF->nHeaderLength = 33;
743 psDBF->panFieldOffset = NULL;
744 psDBF->panFieldSize = NULL;
745 psDBF->panFieldDecimals = NULL;
746 psDBF->pachFieldType = NULL;
747 psDBF->pszHeader = NULL;
749 psDBF->nCurrentRecord = -1;
750 psDBF->bCurrentRecordModified =
FALSE;
751 psDBF->pszCurrentRecord = NULL;
753 psDBF->bNoHeader =
TRUE;
755 psDBF->iLanguageDriver = ldid > 0 ? ldid : 0;
756 psDBF->pszCodePage = NULL;
759 psDBF->pszCodePage = (
char * )
malloc( strlen(pszCodePage) + 1 );
760 strcpy( psDBF->pszCodePage, pszCodePage );
int(* FClose)(SAFile file)
SAOffset(* FWrite)(void *p, SAOffset size, SAOffset nmemb, SAFile file)
int(* Remove)(const char *filename)
SAFile(* FOpen)(const char *filename, const char *access)