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

Segment creation routine. More...

#include <unistd.h>
#include <fcntl.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "local_proto.h"
Include dependency graph for segment/open.c:

Go to the source code of this file.


int Segment_open (SEGMENT *SEG, char *fname, off_t nrows, off_t ncols, int srows, int scols, int len, int nseg)
 Initialize segment structure and open segment file. More...

Detailed Description

Segment creation routine.

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

GRASS GIS Development Team

Definition in file segment/open.c.

Function Documentation

int Segment_open ( SEGMENT SEG,
char *  fname,
off_t  nrows,
off_t  ncols,
int  srows,
int  scols,
int  len,
int  nseg 

Initialize segment structure and open segment file.

Initializes the seg structure and prepares a temporary file. This fn is a wrapper for Segment_format() and Segment_init()

Note: The file with name fname will be created anew.

[in]fnamefile name
[in]nrowsnumber of non-segmented rows
[in]ncolsnumber of non-segmented columns
[in]srowssegment rows
[in]scolssegment columns
[in]lenlength of data type
[in]nsegnumber of segments to remain in memory
1 if successful
-1 if file name is invalid
-2 if file write error
-3 if illegal parameters are passed
-4 if file could not be re-opened
-5 if prepared file could not be read
-6 if out of memory

Definition at line 47 of file segment/open.c.

References _, close(), SEGMENT::fd, SEGMENT::fname, G_store(), G_warning(), Segment_format(), and Segment_init().