mirror of https://github.com/ecmwf/eccodes.git
Message offsets: rework interface
This commit is contained in:
parent
8078e5a6f1
commit
664732b639
|
@ -17,29 +17,26 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
char *filename;
|
||||
int err = 0;
|
||||
size_t num_messages = 0, i =0;
|
||||
int num_messages = 0, i =0;
|
||||
off_t* offsets = NULL;
|
||||
codes_context* c = codes_context_get_default();
|
||||
const int strict_mode = 1;
|
||||
FILE* fp;
|
||||
|
||||
/* Usage: prog file */
|
||||
assert(argc == 2);
|
||||
|
||||
filename = argv[1];
|
||||
fp = fopen(filename, "rb");
|
||||
assert(fp);
|
||||
err = codes_extract_offsets_malloc(c, fp, PRODUCT_GRIB, &offsets, &num_messages, strict_mode);
|
||||
err = codes_extract_offsets_malloc(c, filename, PRODUCT_GRIB, &offsets, &num_messages, strict_mode);
|
||||
assert(!err);
|
||||
|
||||
for (i = 0; i < num_messages; ++i) {
|
||||
printf("Message %lu: %lu\n", i, offsets[i]);
|
||||
printf("Message #%d: %lu\n", i, offsets[i]);
|
||||
}
|
||||
free(offsets);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *filename, *keys;
|
||||
|
@ -87,3 +84,4 @@ int main(int argc, char* argv[])
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue