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

Go to the source code of this file.

Functions

int G_getl (char *buf, int n, FILE *fd)
 gets a line of text from a file More...
 
int G_getl2 (char *buf, int n, FILE *fd)
 gets a line of text from a file of any pedigree More...
 

Function Documentation

int G_getl ( char *  buf,
int  n,
FILE *  fd 
)

gets a line of text from a file

This routine runs fgets() to fetch a line of text from a file (advancing file pointer) and removes trailing newline. fgets() does not recognize '\r' as an EOL and will read past it.

Parameters
buf,:string buffer to receive read data
n,:maximum number of bytes to read
fd,:file descriptor structure
Returns
1 if ok, 0 if EOF

Definition at line 17 of file getl.c.

Referenced by for(), G3d_readHistory(), G__read_cats(), G__read_Cell_head(), G_get_cell_title(), G_get_dig_title(), G_myname(), G_put_cell_title(), and G_read_history().

int G_getl2 ( char *  buf,
int  n,
FILE *  fd 
)

gets a line of text from a file of any pedigree

This routine is like G_getl() but is more portable. It supports text files created on various platforms (UNIX, MacOS9, DOS), i.e. \n (\012), \r (\015), and \r\n (\015\012) style newlines.

Reads in at most n-1 characters from stream (the last spot is reserved for the end-of-string NUL) and stores them into the buffer pointed to by buf. Reading stops after an EOF or a newline. New line is not stored in the buffer. At least n must be allocated for the string buffer.

Parameters
buf,:string buffer to receive read data, at least n must be allocated
n,:maximum number of bytes to read
fd,:file descriptor structure
Returns
1 if ok, 0 if EOF

Definition at line 52 of file getl.c.

Referenced by dig_read_frmt_ascii(), G__raster_misc_read_line(), G_fread_key_value(), G_put_reclass(), G_read_color_rule(), GPJ_get_datum_transform_by_name(), I_get_group_title(), I_list_groups(), I_list_subgroups(), read_coor(), read_datum_table(), read_ellipsoid_table(), read_file(), S_read(), Vect__read_head(), Vect_hist_read(), and Vect_read_dblinks().