00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 # include <config.h>
00021 #endif
00022
00023
00024 #include "Flat.h"
00025
00026 #ifndef ALPHA_LINUX_CXX
00027 # include <cstdio>
00028 #endif
00029 #include <iostream>
00030 #include "exceptions.h"
00031 #include "utils.h"
00032
00033 using std::string;
00034
00035
00036 using std::cout;
00037 using std::cerr;
00038 using std::endl;
00039 using std::FILE;
00040 using std::size_t;
00041
00042
00043 Flat::Flat(const string &n) : U7file(n)
00044 {
00045
00046 FILE *fp;
00047 fp=U7open(filename.c_str(),"rb");
00048 fclose(fp);
00049 }
00050
00051
00052 char * Flat::retrieve(uint32 objnum, size_t &len)
00053 {
00054 FILE *fp;
00055 char *buffer;
00056 fp=U7open(filename.c_str(),"rb");
00057
00058 fseek(fp,0,SEEK_END);
00059 len = ftell(fp);
00060 buffer = new char[len];
00061 fseek(fp,0,SEEK_SET);
00062 fread(buffer,len,1,fp);
00063 fclose(fp);
00064
00065 return buffer;
00066 }