2016-09-06 17:44:27 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2016-09-06 17:44:27 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _FILEHANDLING_H
|
|
|
|
#define _FILEHANDLING_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
2019-08-06 10:22:24 +00:00
|
|
|
#include <inttypes.h>
|
2016-09-06 17:44:27 +00:00
|
|
|
|
2019-07-12 22:20:41 +00:00
|
|
|
#if defined (__CYGWIN__)
|
|
|
|
int _wopen (const char *path, int oflag, ...);
|
|
|
|
#endif
|
2016-09-06 17:44:27 +00:00
|
|
|
|
2021-07-18 19:27:21 +00:00
|
|
|
bool hc_fopen (HCFILE *fp, const char *path, const char *mode);
|
|
|
|
bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode);
|
2021-06-29 18:13:11 +00:00
|
|
|
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
|
|
|
|
int hc_fprintf (HCFILE *fp, const char *format, ...);
|
|
|
|
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
|
|
|
|
int hc_fseek (HCFILE *fp, off_t offset, int whence);
|
|
|
|
void hc_rewind (HCFILE *fp);
|
|
|
|
off_t hc_ftell (HCFILE *fp);
|
|
|
|
int hc_fgetc (HCFILE *fp);
|
|
|
|
int hc_fileno (HCFILE *fp);
|
|
|
|
int hc_feof (HCFILE *fp);
|
|
|
|
void hc_fflush (HCFILE *fp);
|
|
|
|
void hc_fclose (HCFILE *fp);
|
|
|
|
int hc_fputc (int c, HCFILE *fp);
|
|
|
|
char *hc_fgets (char *buf, int len, HCFILE *fp);
|
|
|
|
size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, HCFILE *fp);
|
|
|
|
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
|
2016-09-06 17:44:27 +00:00
|
|
|
|
2019-08-06 10:22:24 +00:00
|
|
|
size_t fgetl (HCFILE *fp, char *line_buf, const size_t line_sz);
|
2019-07-12 22:20:41 +00:00
|
|
|
u64 count_lines (HCFILE *fp);
|
|
|
|
size_t in_superchop (char *buf);
|
2017-02-14 10:14:32 +00:00
|
|
|
size_t superchop_with_length (char *buf, const size_t len);
|
|
|
|
|
2016-09-06 17:44:27 +00:00
|
|
|
|
|
|
|
#endif // _FILEHANDLING_H
|