1 /** 2 * Author......: See docs/credits.txt 3 * License.....: MIT 4 */ 5 6 #ifndef _FILEHANDLING_H 7 #define _FILEHANDLING_H 8 9 #include <stdio.h> 10 #include <string.h> 11 #include <errno.h> 12 #include <inttypes.h> 13 14 #if defined (__CYGWIN__) 15 int _wopen (const char *path, int oflag, ...); 16 #endif 17 18 bool hc_fopen (HCFILE *fp, const char *path, const char *mode); 19 bool hc_fopen_raw (HCFILE *fp, const char *path, const char *mode); 20 int hc_fscanf (HCFILE *fp, const char *format, void *ptr); 21 int hc_fprintf (HCFILE *fp, const char *format, ...); 22 int hc_vfprintf (HCFILE *fp, const char *format, va_list ap); 23 int hc_fseek (HCFILE *fp, off_t offset, int whence); 24 void hc_rewind (HCFILE *fp); 25 int hc_fstat (HCFILE *fp, struct stat *buf); 26 off_t hc_ftell (HCFILE *fp); 27 int hc_fgetc (HCFILE *fp); 28 int hc_feof (HCFILE *fp); 29 void hc_fflush (HCFILE *fp); 30 void hc_fsync (HCFILE *fp); 31 void hc_fclose (HCFILE *fp); 32 int hc_fputc (int c, HCFILE *fp); 33 char *hc_fgets (char *buf, int len, HCFILE *fp); 34 size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, HCFILE *fp); 35 size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp); 36 37 size_t fgetl (HCFILE *fp, char *line_buf, const size_t line_sz); 38 u64 count_lines (HCFILE *fp); 39 size_t in_superchop (char *buf); 40 size_t superchop_with_length (char *buf, const size_t len); 41 42 43 #endif // _FILEHANDLING_H 44