file.h 934 B

12345678910111213141516171819202122232425262728293031323334
  1. /** @file file.h
  2. * @brief Public interface to work with files.
  3. */
  4. #ifndef _faux_file_h
  5. #define _faux_file_h
  6. // For macros definition
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #include <fcntl.h>
  10. #include <faux/faux.h>
  11. typedef struct faux_file_s faux_file_t;
  12. C_DECL_BEGIN
  13. faux_file_t *faux_file_fdopen(int fd);
  14. faux_file_t *faux_file_open(const char *pathname, int flags, mode_t mode);
  15. bool_t faux_file_close(faux_file_t *file);
  16. int faux_file_fileno(faux_file_t *file);
  17. bool_t faux_file_eof(const faux_file_t *file);
  18. char *faux_file_getline_raw(faux_file_t *file);
  19. char *faux_file_getline(faux_file_t *file);
  20. ssize_t faux_file_write(faux_file_t *file, const void *buf, size_t n);
  21. ssize_t faux_file_write_block(faux_file_t *f, const void *buf, size_t n);
  22. ssize_t faux_file_read(faux_file_t *f, void *buf, size_t n);
  23. ssize_t faux_file_read_block(faux_file_t *f, void *buf, size_t n);
  24. C_DECL_END
  25. #endif /* _faux_file_h */