23 #include "libopenraw/io.h" 28 int main (
int argc,
char **argv)
36 f = raw_open(get_default_io_methods(),
"/etc/hosts", O_RDONLY);
39 fprintf(stderr,
"failed to open /etc/hosts\n");
42 fprintf(stderr,
"error code is %d\n", raw_get_error(f));
44 retval = raw_seek(f, 0, SEEK_SET);
46 fprintf(stderr,
"failed to seek\n");
50 fprintf(stderr,
"position is %d\n", retval);
52 retval = raw_read(f, buf, 10);
54 fprintf(stderr,
"failed to read with error %d\n", raw_get_error(f));
58 fprintf(stderr,
"read %d bytes\n", retval);
60 retval = raw_close(f);
62 fprintf(stderr,
"failed to close\n");