GRASS GIS 7 Programmer's Manual  7.0.5(2016)-r00000
segment/get.c
Go to the documentation of this file.
1 
15 #include <string.h>
16 #include "local_proto.h"
17 
18 
19 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
20 /* int Segment_get (SEGMENT *SEG, register int *buf,int row,int col) */
21 
22 
39 int Segment_get(SEGMENT * SEG, void *buf, off_t row, off_t col)
40 {
41  int index, n, i;
42 
43  SEG->address(SEG, row, col, &n, &index);
44  if ((i = seg_pagein(SEG, n)) < 0)
45  return -1;
46 
47  memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
48 
49  return 1;
50 }
int Segment_get(SEGMENT *SEG, void *buf, off_t row, off_t col)
Get value from segment file.
Definition: segment/get.c:39
int seg_pagein(SEGMENT *SEG, int n)
Internal use only.
Definition: pagein.c:37