GRASS Programmer's Manual
6.5.svn(2014)-r66266
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
rowio/setup.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <grass/rowio.h>
4
5
28
int
rowio_setup
(ROWIO * R,
29
int
fd
,
int
nrows,
int
len,
30
int
(*getrow) (
int
,
void
*,
int
,
int
),
31
int
(*putrow) (
int
,
const
void
*,
int
,
int
))
32
{
33
int
i;
34
35
R->getrow = getrow;
36
R->putrow = putrow;
37
R->nrows = nrows;
38
R->len = len;
39
R->cur = -1;
40
R->buf =
NULL
;
41
R->fd =
fd
;
42
43
R->rcb = (
struct
ROWIO_RCB *)
malloc
(nrows *
sizeof
(
struct
ROWIO_RCB));
44
if
(R->rcb ==
NULL
) {
45
fprintf(stderr,
"rowio_setup: out of memory\n"
);
46
return
-1;
47
}
48
for
(i = 0; i < nrows; i++) {
49
R->rcb[i].buf =
malloc
(len);
50
if
(R->rcb[i].buf ==
NULL
) {
51
fprintf(stderr,
"rowio_setup: out of memory\n"
);
52
return
-1;
53
}
54
R->rcb[i].row = -1;
/* mark not used */
55
}
56
return
1;
57
}
fd
FILE * fd
Definition:
g3dcolor.c:368
malloc
void * malloc(YYSIZE_T)
rowio_setup
int rowio_setup(ROWIO *R, int fd, int nrows, int len, int(*getrow)(int, void *, int, int), int(*putrow)(int, const void *, int, int))
configure rowio structure
Definition:
rowio/setup.c:28
NULL
return NULL
Definition:
dbfopen.c:1394
lib
rowio
setup.c
Generated on Sat Jan 2 2016 01:46:49 for GRASS Programmer's Manual by
1.8.5