20 lines
287 B
C
20 lines
287 B
C
#ifndef NS_GET_LINE_H
|
|
#define NS_GET_LINE_H
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "ns_str.h"
|
|
|
|
static int ns_fget_line(FILE *stream, Str *str) {
|
|
char c;
|
|
|
|
while ((c = fgetc(stream)) != '\n') {
|
|
if (c == EOF) {
|
|
return EOF;
|
|
}
|
|
ns_str_push_char(str, c);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
#endif
|