The following example shows how to use the GetFieldCount method to return the number of fields present in the ECLFieldList collection.

// ECLFieldList::GetFieldCount
// Display number of fields on the screen.
void Sample40() {
ECLPS        *PS;           // Pointer to PS object
ECLFieldList *FieldList;    // Pointer to field list object
try {
  PS = new ECLPS('A');                // Create PS object for 'A'
  FieldList = PS->GetFieldList();     // Get pointer to field list
  FieldList->Refresh();               // Build the field list
  printf("There are %lu fields on the screen of connection %c.\n",
    FieldList->GetFieldCount(), PS->GetName());
  delete PS;
catch (ECLErr Err) {
  printf("ECL Error: %s\n", Err.GetMsgText());
} // end sample