dataPreprocessing/prepareShpFiles.c
int copyAttributes(DBFHandle dbfIn, DBFHandle dbfOut, int inShp, int outShp)
{
  int bOk = 1;
  int count = DBFGetFieldCount(dbfIn);
  int i = 0; 
  DBFFieldType type = 0;
  char fieldName[16];
  int width = 0;
  int decimals = 0;
  const char * fieldVal = NULL;
  char stringField[256];
  int intVal = 0;
  double doubleVal = 0.0;
  for (i = 0; (i < count) && (bOk > 0); i++)
    {
    type =  DBFGetFieldInfo(dbfIn,i,fieldName,&width,&decimals);
    switch (type)
      {
      case FTString:
        fieldVal = DBFReadStringAttribute(dbfIn,inShp,i);
	bOk =  DBFWriteStringAttribute(dbfOut,outShp,i,fieldVal);
	break;
      case FTInteger:
        intVal = DBFReadIntegerAttribute(dbfIn,inShp,i);
	bOk = DBFWriteIntegerAttribute(dbfOut,outShp,i,intVal);
	break;
      case FTDouble:
        doubleVal =  DBFReadDoubleAttribute(dbfIn,inShp,i);
	bOk = DBFWriteDoubleAttribute(dbfOut,outShp,i,doubleVal);
	break;
      default:
	printf("Unexpected attribute type found - %d\n",type);
	bOk = 0;
      }
    }
    return bOk;
}
/* Copy a set of attribute values from the input DBF file to the
 * output DBF file.
 *    dbfIn       File handle for input DBF
 *    dbfOut      File handle for output DBF
 *    inShp       Number of record to copy from input
 *    outShp      Number of record to copy to in the output
 * Returns 1 if all is okay, 0 if error occurred
 */
Copy a set of attribute values from the input DBF file to the
output DBF file.
dbfIn       File handle for input DBF
dbfOut      File handle for output DBF
inShp       Number of record to copy from input
outShp      Number of record to copy to in the output
Returns 1 if all is okay, 0 if error occurred
Copy a set of attribute values from the input DBF file to the output DBF file . dbfIn File handle for input DBF dbfOut File handle for output DBF inShp Number of record to copy from input outShp Number of record to copy to in the output Returns 1 if all is okay 0 if error occurred
int copyAttributes(DBFHandle dbfIn, DBFHandle dbfOut, int inShp, int outShp)
{
  int bOk = 1;
  int count = DBFGetFieldCount(dbfIn);
  int i = 0; 
  DBFFieldType type = 0;
  char fieldName[16];
  int width = 0;
  int decimals = 0;
  const char * fieldVal = NULL;
  char stringField[256];
  int intVal = 0;
  double doubleVal = 0.0;
  for (i = 0; (i < count) && (bOk > 0); i++)
    {
    type =  DBFGetFieldInfo(dbfIn,i,fieldName,&width,&decimals);
    switch (type)
      {
      case FTString:
        fieldVal = DBFReadStringAttribute(dbfIn,inShp,i);
	bOk =  DBFWriteStringAttribute(dbfOut,outShp,i,fieldVal);
	break;
      case FTInteger:
        intVal = DBFReadIntegerAttribute(dbfIn,inShp,i);
	bOk = DBFWriteIntegerAttribute(dbfOut,outShp,i,intVal);
	break;
      case FTDouble:
        doubleVal =  DBFReadDoubleAttribute(dbfIn,inShp,i);
	bOk = DBFWriteDoubleAttribute(dbfOut,outShp,i,doubleVal);
	break;
      default:
	printf("Unexpected attribute type found - %d\n",type);
	bOk = 0;
      }
    }
    return bOk;
}
int copyAttributes ( DBFHandle dbfIn , DBFHandle dbfOut , int inShp , int outShp ) { int bOk = 1 ; int count = DBFGetFieldCount ( dbfIn ) ; int i = 0 ; DBFFieldType type = 0 ; char fieldName [ 16 ] ; int width = 0 ; int decimals = 0 ; const char * fieldVal = NULL ; char stringField [ 256 ] ; int intVal = 0 ; double doubleVal = 0.0 ; for ( i = 0 ; ( i < count ) && ( bOk > 0 ) ; i ++ ) { type = DBFGetFieldInfo ( dbfIn , i , fieldName , & width , & decimals ) ; switch ( type ) { case FTString : fieldVal = DBFReadStringAttribute ( dbfIn , inShp , i ) ; bOk = DBFWriteStringAttribute ( dbfOut , outShp , i , fieldVal ) ; break ; case FTInteger : intVal = DBFReadIntegerAttribute ( dbfIn , inShp , i ) ; bOk = DBFWriteIntegerAttribute ( dbfOut , outShp , i , intVal ) ; break ; case FTDouble : doubleVal = DBFReadDoubleAttribute ( dbfIn , inShp , i ) ; bOk = DBFWriteDoubleAttribute ( dbfOut , outShp , i , doubleVal ) ; break ; default : printf ( " \n " , type ) ; bOk = 0 ; } } return bOk ; }
Copy a set of attribute values from the input DBF file to the
 output DBF file.
Copy a set of attribute values from the input DBF file to the output DBF file .