/* * Reads HDF5 file "ublock.h5" that contains a user * block of size 512. Type "h5dump -B" on the file to * see the size of the user block, or call H5Pget_userblock * to obtain the size in an application. */ #include #include int main(void) { int i; unsigned char buffer[512]; size_t ret; FILE *fp = fopen("ublock.h5", "r"); if (!fp) { perror("fopen"); return EXIT_FAILURE; } ret = fread(buffer, 1, 512, fp); printf ("\nContents of User Block:\n"); for (i=0;i<512;i++) printf("%c", buffer[i]); printf("\n"); fclose(fp); }