GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
segment/get.c
Go to the documentation of this file.
1 
15 #include <string.h>
16 #include <grass/segment.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 
41 int segment_get(SEGMENT * SEG, void *buf, int row, int col)
42 {
43  int index, n, i;
44 
45  segment_address(SEG, row, col, &n, &index);
46  if ((i = segment_pagein(SEG, n)) < 0)
47  return -1;
48 
49  memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
50 
51  return 1;
52 }
int segment_pagein(SEGMENT *SEG, int n)
Segment pagein.
Definition: pagein.c:39
int segment_address(const SEGMENT *SEG, int row, int col, int *n, int *index)
Definition: address.c:31
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
Definition: g3drange.c:62
int n
Definition: dataquad.c:291
int segment_get(SEGMENT *SEG, void *buf, int row, int col)
Get value from segment file.
Definition: segment/debug.c:48