need help shapelib

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

need help shapelib

calpas calpas
Dear all,
 this is a simple program I' writting in order to collect the shapefile type:
#include "shapelib/shapefil.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main (int argc, char ** argv)
{
     char * filepath;
     char *  accessType;
    int *  pnEntities;
    int * pnShapeType = NULL;
        double * padfMinBound;
    double * padfMaxBound;
    SHPHandle hSHP;
    FILE * istream;

    filepath= "/home/geotema/valatest/data/point_bycicle_sharing.shp";
    accessType= "rb";
   
    if ( (istream = fopen ( filepath, "rb" ) ) == NULL )
    {
        printf ( "file non-existant!\n" );
    }
    else
    {
        printf ( "file exists!\n" );
           
    hSHP = SHPOpen(filepath,"rb");
   
    SHPGetInfo(hSHP,pnEntities,pnShapeType, padfMinBound, padfMaxBound);
    hSHP = (SHPHandle)malloc(sizeof(SHPHandle));
    printf("hELLO World \nShape type %d\n  ", hSHP->nShapeType);
        fclose ( istream );
    }

    return 1;
}

In order to link my program with the shape lib, what I've through my Makefile.am is defining the following parameters:

bin_PROGRAMS= readshapetest
readshapetest_SOURCES = readshapetest.c shapelib/shpopen.c shapelib/shapefil.h
clean:
    rm -f *.o *.c

the compiling step is successful, unfortunately I'm keeping on having 0 as output. can you please tell me where I'm failing

Cheers.......



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Loading...