GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rowio/setup.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <grass/rowio.h>
Include dependency graph for rowio/setup.c:

Go to the source code of this file.

Functions

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 More...
 

Function Documentation

int rowio_setup ( ROWIO *  R,
int  fd,
int  nrows,
int  len,
int(*)(int, void *, int, int getrow,
int(*)(int, const void *, int, int putrow 
)

configure rowio structure

Rowio_setup() initializes the ROWIO structure r and allocates the required memory buffers. The file descriptor fd must be open for reading. The number of rows to be held in memory is nrows. The length in bytes of each row is len. The routine which will be called to read data from the file is getrow() and must be provided by the programmer. If the application requires that the rows be written back into the file if changed, the file descriptor fd must be open for write as well, and the programmer must provide a putrow() routine to write the data into the file. If no writing of the file is to occur, specify NULL for putrow(). Return codes: 1 ok -1 there is not enough memory for buffer allocation

Parameters
\returnint

Definition at line 28 of file rowio/setup.c.

References fd, malloc(), and NULL.