2020-05-18 16:51:10 +03:00
|
|
|
#ifndef __IDRIS_FILE_H
|
|
|
|
#define __IDRIS_FILE_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2021-06-10 13:24:05 +03:00
|
|
|
#include <stdint.h>
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
FILE* idris2_openFile(char* name, char* mode);
|
|
|
|
void idris2_closeFile(FILE* f);
|
|
|
|
|
|
|
|
int idris2_fileError(FILE* f);
|
|
|
|
|
|
|
|
// Turn errno into an integer understandable by System.File
|
|
|
|
int idris2_fileErrno();
|
|
|
|
|
2020-05-21 15:32:35 +03:00
|
|
|
int idris2_removeFile(const char *filename);
|
2020-05-18 16:51:10 +03:00
|
|
|
int idris2_fileSize(FILE* h);
|
|
|
|
|
|
|
|
int idris2_fpoll(FILE* f);
|
|
|
|
|
2021-02-18 14:13:25 +03:00
|
|
|
// Seek through the next newline without
|
|
|
|
// saving anything along the way
|
|
|
|
int idris2_seekLine(FILE* f);
|
|
|
|
|
2020-05-18 16:51:10 +03:00
|
|
|
// Treat as a Ptr String (might be NULL)
|
|
|
|
char* idris2_readLine(FILE* f);
|
2020-06-11 22:35:18 +03:00
|
|
|
char* idris2_readChars(int num, FILE* f);
|
2021-06-10 13:19:09 +03:00
|
|
|
size_t idris2_readBufferData(FILE* h, char* buffer, size_t loc, size_t max);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
int idris2_writeLine(FILE* f, char* str);
|
2021-06-10 13:19:09 +03:00
|
|
|
size_t idris2_writeBufferData(FILE* h, const char* buffer, size_t loc, size_t len);
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
int idris2_eof(FILE* f);
|
|
|
|
int idris2_fileAccessTime(FILE* f);
|
|
|
|
int idris2_fileModifiedTime(FILE* f);
|
|
|
|
int idris2_fileStatusTime(FILE* f);
|
|
|
|
|
|
|
|
FILE* idris2_stdin();
|
|
|
|
FILE* idris2_stdout();
|
|
|
|
FILE* idris2_stderr();
|
|
|
|
|
|
|
|
#endif
|