GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
eol.c
Go to the documentation of this file.
1
2
/***********************************************************
3
* I_get_to_eol (line,len,fd)
4
*
5
* Reads from fd until the newline, copying the first len-1
6
* characters into line. The newline is not copied.
7
* len should be the length of line in bytes. This allows for
8
* a NULL to be added at the end.
9
***********************************************************/
10
#include <
grass/imagery.h
>
11
#include <stdio.h>
12
int
I_get_to_eol
(
char
*line,
int
len, FILE * fd)
13
{
14
int
c;
15
int
n;
16
17
n = len - 1;
18
while
((c = fgetc(fd)) >= 0 && c !=
'\n'
)
19
if
(n-- > 0)
20
*line++ = c;
21
if
(len > 0)
22
*line = 0;
23
return
c ==
'\n'
;
24
}
imagery.h
I_get_to_eol
int I_get_to_eol(char *line, int len, FILE *fd)
Definition:
eol.c:12
lib
imagery
eol.c
Generated on Mon May 31 2021 05:21:29 for GRASS GIS 7 Programmer's Manual by
1.8.13