I'm trying to check if a shapefile has the fast feature count. I have the following C++ code:
#include <iostream>
#include "ogrsf_frmts.h"
int main()
{
GDALAllRegister();
GDALDataset *poDS;
poDS = (GDALDataset*)GDALOpenEx("C:/Users/root/Desktop/2016/GIS Programming/Plugin_new_new/Shapefiles_Karte/Ortsstrasse/temp/buildings - Kopie (2).shp", GDAL_OF_VECTOR, NULL, NULL, NULL);
if (poDS == NULL)
{
printf("Open failed.\n");
exit(1);
}
if (poDS->TestCapability(OLCFastFeatureCount) == true) {
printf("true\n");
} else {
printf("false\n");
}
GDALClose(poDS);
}
The code tells me every time "false" even though I am 100% sure the input shapefile has the fast feature count ability.
So I assume that there is a problem in the function call. Isn't this the way you call the TestCapability function?
I am very new to C++ and have only used GDAL with Python so far ..