PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ DBFGetFieldIndex()

int SHPAPI_CALL DBFGetFieldIndex ( DBFHandle  psDBF,
const char *  pszFieldName 
)

Definition at line 1703 of file dbfopen.c.

References DBFGetFieldCount(), DBFGetFieldInfo(), and str_to_upper().

1705 {
1706  char name[12], name1[12], name2[12];
1707  int i;
1708 
1709  strncpy(name1, pszFieldName,11);
1710  name1[11] = '\0';
1711  str_to_upper(name1);
1712 
1713  for( i = 0; i < DBFGetFieldCount(psDBF); i++ )
1714  {
1715  DBFGetFieldInfo( psDBF, i, name, NULL, NULL );
1716  strncpy(name2,name,11);
1717  str_to_upper(name2);
1718 
1719  if(!strncmp(name1,name2,10))
1720  return(i);
1721  }
1722  return(-1);
1723 }
DBFFieldType SHPAPI_CALL DBFGetFieldInfo(DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
Definition: dbfopen.c:1221
int SHPAPI_CALL DBFGetFieldCount(DBFHandle psDBF)
Definition: dbfopen.c:1195
static void str_to_upper(char *string)
Definition: dbfopen.c:1682
Here is the call graph for this function: