mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-12-27 05:40:17 +05:30
freadln.*: ignore end of transmission
This commit is contained in:
parent
858898aaa3
commit
00d03e39fc
@ -42,7 +42,7 @@ int freadln(FILE* f, char** output, size_t* length_out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int character;
|
int character;
|
||||||
while ((character = fgetc(f)) != EOF
|
while ((character = fgetc(f)) != EOF && character != EOT
|
||||||
/* stop on a newline character: */ && character != '\n') {
|
/* stop on a newline character: */ && character != '\n') {
|
||||||
(*output)[length] = (char) character;
|
(*output)[length] = (char) character;
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define EOT 4 /* end of transmission */
|
||||||
|
|
||||||
typedef size_t freadln_length_type;
|
typedef size_t freadln_length_type;
|
||||||
|
|
||||||
enum freadln_status {
|
enum freadln_status {
|
||||||
|
Loading…
Reference in New Issue
Block a user