7 #define ASCIIFILE_INCLUDED 10 #define LINE_SIZE_MAX 1024*2 42 if (af_is_open(*t) == 0) {
43 (*t).fd = fopen((*t).filepath, (*t).io_mode);
60 if (af_is_open(*t) == 1) {
77 int af_is_comment(
const asciiFile_t t,
const char *line) {
95 int af_readline_full(
const asciiFile_t t,
char **line,
size_t *n) {
96 if (af_is_open(t) == 1) {
97 return getline(line, n, t.
fd);
109 int af_writeline_full(
const asciiFile_t t,
const char *line) {
110 if (af_is_open(t) == 1)
111 return fwrite(line, 1, strlen(line), t.
fd);
const char * filepath
Full path to file.
Definition: AsciiFile.h:14
char comment[64]
Character(s) indicating a comment.
Definition: AsciiFile.h:16
char newline[64]
Character(s) indicating a newline.
Definition: AsciiFile.h:17
char io_mode[64]
I/O mode. 'r' for read, 'w' for write.
Definition: AsciiFile.h:15
Structure containing information about an ASCII text file.
Definition: AsciiFile.h:13
FILE * fd
File identifier for ASCII file when open.
Definition: AsciiFile.h:18