1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-12-26 11:30:03 +05:30

freadln.*: ignore end of transmission

This commit is contained in:
Intel A80486DX2-66 2024-04-05 21:40:19 +03:00
parent 858898aaa3
commit 00d03e39fc
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
2 changed files with 3 additions and 1 deletions

View File

@ -42,7 +42,7 @@ int freadln(FILE* f, char** output, size_t* length_out) {
}
int character;
while ((character = fgetc(f)) != EOF
while ((character = fgetc(f)) != EOF && character != EOT
/* stop on a newline character: */ && character != '\n') {
(*output)[length] = (char) character;

View File

@ -12,6 +12,8 @@
#include <stdio.h>
#include <stdlib.h>
#define EOT 4 /* end of transmission */
typedef size_t freadln_length_type;
enum freadln_status {