Quote:Hello recently I am using ECMWF library to read GRIB file and everything is ok when I built the program but it could not read the GRIB file so it gives me "End of resource reached when reading message" this error even though i am using different GRIB file. thank you for answering.
#include <stdio.h> #include <stdlib.h> extern "C"{ #include <grib_api.h> } #include <qdebug.h> #include <QtCore/QCoreApplication> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); int err = 0,i; double *values = NULL; double max,min,average; size_t values_len= 0; //FILE* in = NULL; grib_handle *h = NULL; const char* path = "exmaple.grb"; FILE* in = fopen( path,"r" ); if(!in) { printf("ERROR: unable to open file %s\n",path); return 1; } h = grib_handle_new_from_file(0,in,&err); "problem is here err = -44 it means" "End of resource reached when reading message" if (h == NULL) { printf("Error: unable to create handle from file %s\n",path); } GRIB_CHECK(grib_get_size(h,"values",&values_len),0); return a.exec(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)