libidx-c

C library for IDX file format
git clone https://git.sinitax.com/sinitax/libidx-c
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

test.c (504B)


      1#include "idx.h"
      2
      3#include <stdio.h>
      4
      5int
      6main(int argc, const char **argv)
      7{
      8	struct idx data;
      9	int i, status;
     10	uint8_t *p;
     11
     12	status = idx_load(&data, argv[1]);
     13	if (status != IDX_OK) {
     14		printf("Failed to load file: %i\n", status);
     15		return 1;
     16	}
     17
     18	printf("DIMS: ");
     19	for (i = 0; i < data.dims.count; i++)
     20		printf("%s%i", i ? " x " : "", data.dims.sizes[i]);
     21	printf("\n");
     22
     23	printf("Value at 10 x 10 x 10: ");
     24	p = idx_get(&data, 3, 10, 10, 10);
     25	printf("%02X\n", p ? *p : 0);
     26
     27	idx_deinit(&data);
     28}