2
simple file access interface.
3
Copyright (C) 2001 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
15
#include "fileAccess.h"
18
FileAccess::FileAccess() {
24
FileAccess::~FileAccess() {
29
int FileAccess::open(const char* path) {
31
file=fopen(path,"rb");
32
length=calcByteLength();
33
return (file != NULL);
37
void FileAccess::close() {
46
int FileAccess::read(char* dest,int len) {
49
back=fread(dest,1,len,file);
51
printf("FileAccess::read not open\n");
56
int FileAccess::eof() {
65
int FileAccess::seek(long pos) {
69
return fseek(file,pos,SEEK_SET);
73
long FileAccess::getBytePosition() {
81
long FileAccess::getByteLength() {
85
long FileAccess::calcByteLength() {
89
long pos=getBytePosition();
90
fseek(file,0,SEEK_END);
91
long back=getBytePosition();
92
fseek(file,pos,SEEK_SET);