Commit 5a63f951 authored by cRTrn13's avatar cRTrn13

file handler

parent 20617dcb
#include "file.h"
Fhat ILE_H* file_open(const char* filename, uint8_t mode)
FILE_H* file_open(const char* filename, uint8_t mode)
{
//file_open_linux(filename, mode);
//return file_open_linux(filename, mode);
}
FILE_H* file_close(FILE_H* file)
FILE_H* file_seek(FILE_H* file, int64_t offset, int64_t origin);
FILE_H* file_tell(FILE_H* file);
FILE_H* file_read(FILE_H* file, uint8_t *buf, int64_t count);
FILE_H* file_write(FILE_H* file, uint8_t *buf, int64_t count);
void file_close(FILE_H* file)
{
file->close(file);
}
uint64_t file_seek(FILE_H* file, uint64_t offset, uint64_t origin)
{
file->seek(file, offset, origin);
}
uint64_t file_tell(FILE_H* file)
{
file->tell(file);
}
int file_read(FILE_H* file, uint8_t *buf, uint64_t count)
{
file->read(file, buf, count);
}
int file_write(FILE_H* file, uint8_t *buf, uint64_t count)
{
file->write(file, buf, count);
}
......@@ -11,17 +11,17 @@ struct file
{
void* internal;
void (*close)(FILE_H* file);
int64_t (*seek)(FILE_H* file, int64_t offset, int64_t origin);
int64_t (*tell)(FILE_H* file);
int (*read)(FILE_H* file, uint8_t *buf, int64_t count);
int (*write)(FILE_H* file, uint8_t *buf, int64_t count);
uint64_t (*seek)(FILE_H* file, uint64_t offset, uint64_t origin);
uint64_t (*tell)(FILE_H* file);
int (*read)(FILE_H* file, uint8_t *buf, uint64_t count);
int (*write)(FILE_H* file, uint8_t *buf, uint64_t count);
};
FILE_H* file_open(const char* filename, uint8_t mode);
FILE_H* file_close(FILE_H* file);
FILE_H* file_seek(FILE_H* file, int64_t offset, int64_t origin);
FILE_H* file_tell(FILE_H* file);
FILE_H* file_read(FILE_H* file, uint8_t *buf, int64_t count);
FILE_H* file_write(FILE_H* file, uint8_t *buf, int64_t count);
FILE_H *file_open(const char* filename, uint8_t mode);
void file_close(FILE_H* file);
uint64_t file_seek(FILE_H* file, uint64_t offset, uint64_t origin);
uint64_t file_tell(FILE_H* file);
int file_read(FILE_H* file, uint8_t *buf, uint64_t count);
int file_write(FILE_H* file, uint8_t *buf, uint64_t count);
#endif /* FILE_H_ */
......@@ -9,7 +9,8 @@ int64_t file_tell_linux(FILE_H* file);
int file_read_linux(FILE_H* file, uint8_t *buf, int64_t count);
int file_write_linux(FILE_H* file, uint8_t *buf, int64_t count);
FILE_H* file_open_linux(const char* filename, uint8_t mode)
FILE_H *file_open_linux(const char* filename, uint8_t mode)
{
FILE_H *file = malloc(sizeof(FILE_H));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment