aboutsummaryrefslogtreecommitdiff
path: root/include/bh/file.h
blob: 7718c80866bfe051fd13b90a9abd25b49a632aa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef BHLIB_FILE_H
#define BHLIB_FILE_H

#include "io.h"

typedef struct bh_file_s bh_file_t;

bh_file_t *bh_file_new(const char *path, 
                       const char *mode);
                       
void bh_file_free(bh_file_t *file);

size_t bh_file_read(bh_file_t *file,
                    char *buffer,
                    size_t size);

size_t bh_file_write(bh_file_t *file,
                     const char *buffer,
                     size_t size);

void bh_file_flush(bh_file_t *file);

void bh_file_seek(bh_file_t *file,
                  bh_off_t pos,
                  int dir);

bh_off_t bh_file_tell(bh_file_t *file);

bh_off_t bh_file_available(bh_file_t *file);

int bh_file_error(bh_file_t *file);

int bh_file_eof(bh_file_t *file);

void bh_file_clear(bh_file_t *file); 

#endif /* BHLIB_FILE_H */