1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-11-15 05:45:55 +05:30
gists/c-programming/io/freadln.h

32 lines
777 B
C
Raw Normal View History

2024-02-20 04:08:45 +05:30
/*
* freadln.h
*
* Author: Intel A80486DX2-66
* License: Creative Commons Zero 1.0 Universal
*/
#ifndef _FREADLN_H
#define _FREADLN_H
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
typedef size_t freadln_length_type;
enum freadln_status {
2024-03-10 16:49:29 +05:30
freadln_OK,
2024-02-20 04:08:45 +05:30
freadln_ERROR
};
#define freadln_success_epilogue do { \
(*output)[length] = '\0'; \
2024-03-10 16:44:02 +05:30
if (length_out != NULL) \
2024-02-20 04:08:45 +05:30
*length_out = length; \
2024-03-10 16:44:02 +05:30
return freadln_OK; \
2024-02-22 21:39:37 +05:30
} while (0)
2024-02-20 04:08:45 +05:30
2024-03-10 16:44:02 +05:30
int freadln(char** output, size_t* length_out);
2024-02-22 21:39:37 +05:30
2024-02-20 04:08:45 +05:30
#endif /* _FREADLN_H */