1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-11-09 21:32:02 +05:30
gists/c-programming/io/freadln.h

35 lines
808 B
C

/*
* freadln.h
*
* Author: Intel A80486DX2-66
* License: Unlicense
*/
#ifndef _FREADLN_H
#define _FREADLN_H
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#define EOT 4 /* end of transmission */
typedef size_t freadln_length_type;
enum freadln_status {
freadln_OK,
freadln_EOF,
freadln_ERROR
};
#define freadln_epilogue do { \
(*output)[length] = '\0'; \
if (length_out != NULL) \
*length_out = length; \
} while (0)
int freadln(FILE* f, char** output, size_t* length_out);
#define finreadln(output, length_out) freadln(stdin, output, length_out)
#endif /* _FREADLN_H */