GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
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
}
lib
imagery
eol.c
Generated on Sat Oct 5 2013 12:11:06 for GRASS Programmer's Manual by
1.8.4