SBDP02/io.h
2018-12-08 21:03:55 +01:00

29 lines
548 B
C

#ifndef IO_H
#define IO_H
#define PAGE_SIZE 512
#define PAGE_NONE 0
#include <stdio.h>
#include <inttypes.h>
typedef struct {
FILE* file;
char* filename;
size_t page_size;
void* buffer;
} file_t;
typedef uint64_t page_t;
typedef uint64_t offset_t;
file_t* file_open(const char* filename, const char* mode, size_t page_size);
void file_close(file_t* file);
size_t file_read(file_t* file, unsigned block, void* buffer, size_t size);
size_t file_write(file_t* file, unsigned block, const void* buffer, size_t size);
#endif