#define _GNU_SOURCE #define _FILE_OFFSET_BITS 64 #include #include #include int main () { char ch; loff_t res; int fd; loff_t offset; int i; offset = (unsigned long)5735142 * 512; fd = open ("/dev/hdf8", O_RDONLY); res = lseek64 (fd, 0, SEEK_END); if (res < 0) { printf ("cannot lseek64 %m\n"); return 1; } else { printf ("lseek64 SEEK_END to %Lu\n", res); } for (i = 0; i < 12; i++) { res = lseek64 (fd, offset, SEEK_SET); if (res < 0) { printf ("cannot lseek64 to %Lu", offset); return 1; } else { printf ("lseek64 to %Lu\n", res); } if (read (fd, &ch, 1) < 0) { printf ("cannot read %m\n"); // return 1; } else { printf ("read a byte\n"); } offset -= 512; } return 0; }