GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
GIS Library - Get line of text from file. More...
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... | |
GIS Library - Get line of text from file.
(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.
Definition in file getl.c.
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.
buf | string buffer to receive read data |
n | maximum number of bytes to read |
fd | file descriptor structure |
Definition at line 33 of file getl.c.
References G_getl2().
Referenced by G__read_Cell_head(), G_matrix_read(), G_myname(), Rast__read_history(), and Rast_get_cell_title().
int G_getl2 | ( | char * | buf, |
int | n, | ||
FILE * | fd | ||
) |
Gets a line of text from a file of any pedigree.
This routine 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 bytes must be allocated for the string buffer.
buf | string buffer to receive read data, at least n bytes must be allocated |
n | maximum number of bytes to read |
fd | file descriptor structure |
Definition at line 60 of file getl.c.
References NULL.
Referenced by dig_read_frmt_ascii(), G_getl(), I_get_group_title(), Rast_get_vrt(), read_coor(), Vect__read_head(), and Vect_read_ascii_head().