#ifndef TAPE_H_ #define TAPE_H_ #include #include "record.h" #define PAGE_SIZE 4096 #define TAPE_READ "rb" #define TAPE_WRITE "wb" #define TAPE_APPEND "ab" extern unsigned reads; extern unsigned writes; typedef struct { FILE* file; char* name; const char* mode; void* buffer; unsigned offset; size_t read; int block; } tape_t; tape_t* tape_open(const char* filename, const char* mode); void tape_close(tape_t* tape); void* tape_read(tape_t* tape, void* record, size_t size); int tape_write(tape_t* tape, void* record, size_t size); int tape_rewind(tape_t* tape, size_t count, size_t size); #endif