I'm trying to open a geotiff from the ASTER data set, but it gives an error that I've been unable to figure out. Here is my code:
#include "stdlib.h"
#include "stdio.h"
#include "tiffio.h"
void read(void);
void main() {
read();
return;
}
void read(void) {
TIFF* file;
file = TIFFOpen("./ASTGTM2_N50E002_dem.tif", "r");
if (file != NULL)
TIFFClose(file);
else
printf( "won't open\n" );
return;
}
I am compiling like so:
gcc parse.c -ltiff -lm;
This is a part of the output I get:
TIFFOpen: ./ASTGTM2_N50E002_dem.tif: Too many open files.
./ASTGTM2_N50E002_dem.tif: Cannot read TIFF header.
The second message repeats a few hundred times, then
won't open
displays a few hundred times after that.
read() is being called once, why am I getting some 700-odd prints?
I'm running Debian, I checked
lsof | grep ASTGTM2_N50E002_dem.tif
and no one has this file open.
I also followed the suggestion here: https://stackoverflow.com/a/9012019/1877851
I am still receiving the same error. What's going on?