dataPreprocessing/prepareShpFiles.c
int initializeDbfFields(DBFHandle dbfIn, DBFHandle dbfOut)
{
  int bOk = 1;
  int count = DBFGetFieldCount(dbfIn);
  int i = 0; 
  DBFFieldType type = 0;
  char fieldName[16];
  char revisedFieldName[16];
  int width = 0;
  int decimals = 0;
  for (i = 0; (i < count) && (bOk > 0); i++)
    {
    type =  DBFGetFieldInfo(dbfIn,i,fieldName,&width,&decimals);
    strcpy(revisedFieldName,fieldName);
    lowerCase(fieldName);
    if (strstr(fieldName,"name"))
       strcpy(revisedFieldName,"name");
    if (DBFAddField(dbfOut,revisedFieldName,type,width,decimals) != i) 
       {
       printf("Error adding DB field number %d\n", i);
       bOk = 0;
       }
    }
  return bOk;
}
/* Initializes the output DBF file to have the same fields
 * as the input DBF file 
 *    dbfIn       File handle for input DBF
 *    dbfOut      File handle for output DBF
 * Returns 1 if all is okay, 0 if error occurred
 */
Initializes the output DBF file to have the same fields
as the input DBF file
dbfIn       File handle for input DBF
dbfOut      File handle for output DBF
Returns 1 if all is okay, 0 if error occurred
Initializes the output DBF file to have the same fields as the input DBF file dbfIn File handle for input DBF dbfOut File handle for output DBF Returns 1 if all is okay 0 if error occurred
int initializeDbfFields(DBFHandle dbfIn, DBFHandle dbfOut)
{
  int bOk = 1;
  int count = DBFGetFieldCount(dbfIn);
  int i = 0; 
  DBFFieldType type = 0;
  char fieldName[16];
  char revisedFieldName[16];
  int width = 0;
  int decimals = 0;
  for (i = 0; (i < count) && (bOk > 0); i++)
    {
    type =  DBFGetFieldInfo(dbfIn,i,fieldName,&width,&decimals);
    strcpy(revisedFieldName,fieldName);
    lowerCase(fieldName);
    if (strstr(fieldName,"name"))
       strcpy(revisedFieldName,"name");
    if (DBFAddField(dbfOut,revisedFieldName,type,width,decimals) != i) 
       {
       printf("Error adding DB field number %d\n", i);
       bOk = 0;
       }
    }
  return bOk;
}
int initializeDbfFields ( DBFHandle dbfIn , DBFHandle dbfOut ) { int bOk = 1 ; int count = DBFGetFieldCount ( dbfIn ) ; int i = 0 ; DBFFieldType type = 0 ; char fieldName [ 16 ] ; char revisedFieldName [ 16 ] ; int width = 0 ; int decimals = 0 ; for ( i = 0 ; ( i < count ) && ( bOk > 0 ) ; i ++ ) { type = DBFGetFieldInfo ( dbfIn , i , fieldName , & width , & decimals ) ; strcpy ( revisedFieldName , fieldName ) ; lowerCase ( fieldName ) ; if ( strstr ( fieldName , " " ) ) strcpy ( revisedFieldName , " " ) ; if ( DBFAddField ( dbfOut , revisedFieldName , type , width , decimals ) != i ) { printf ( " \n " , i ) ; bOk = 0 ; } } return bOk ; }
Initializes the output DBF file to have the same fields
 as the input DBF file
    dbfIn       File handle for input DBF
    dbfOut      File handle for output DBF
 Returns 1 if all is okay, 0 if error occurred
Initializes the output DBF file to have the same fields as the input DBF file dbfIn File handle for input DBF dbfOut File handle for output DBF Returns 1 if all is okay 0 if error occurred