GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72387
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rowio/setup.c File Reference

RowIO library - Setup. More...

#include <stdio.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/rowio.h>
Include dependency graph for rowio/setup.c:

Go to the source code of this file.


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

Detailed Description

RowIO library - Setup.

(C) 2001-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Original author CERL

Definition in file rowio/setup.c.

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().

Rpointer to ROWIO structure
fdfile descriptor
nrowsnumber of rows
getrowget row function
1 on success
-1 no memory

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

References _, ROWIO::buf, ROWIO::ROWIO_RCB::buf, ROWIO::cur, ROWIO::fd, fd, G_warning(), ROWIO::getrow, ROWIO::len, ROWIO::nrows, NULL, ROWIO::putrow, ROWIO::rcb, and ROWIO::ROWIO_RCB::row.