GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
segment/seek.c
Go to the documentation of this file.
1 
15 #include <stdio.h>
16 #include <sys/types.h>
17 #include <unistd.h>
18 #include <string.h>
19 #include <errno.h>
20 #include <grass/config.h>
21 #include <grass/gis.h>
22 #include <grass/segment.h>
23 
24 
37 int segment_seek(const SEGMENT * SEG, int n, int index)
38 {
39  off_t offset;
40 
41  offset = (off_t) n *SEG->size + index + SEG->offset;
42 
43  if (lseek(SEG->fd, offset, SEEK_SET) == (off_t) - 1) {
44  G_warning("segment_seek: %s", strerror(errno));
45  return -1;
46  }
47 
48  return 0;
49 }
int segment_seek(const SEGMENT *SEG, int n, int index)
Definition: segment/seek.c:37
if(!YY_CURRENT_BUFFER)
Definition: lex.yy.c:799
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int errno
int n
Definition: dataquad.c:291