pss-total/lib/include/ns_fget_line.h

21 lines
287 B
C
Raw Normal View History

2024-05-24 21:54:17 +00:00
#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