forked from ponchio/untrunc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile.h
More file actions
35 lines (28 loc) · 629 Bytes
/
file.h
File metadata and controls
35 lines (28 loc) · 629 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef FILE_H
#define FILE_H
#include <stdio.h>
#include <vector>
#include <string>
class File {
public:
File();
~File();
bool open(std::string filename);
bool create(std::string filename);
void seek(long p);
long pos();
bool atEnd();
long length() { return size; }
int readInt();
int readInt64();
void readChar(char *dest, int n);
std::vector<unsigned char> read(long n);
int writeInt(int n);
int writeInt64(int n);
int writeChar(char *source, int n);
int write(std::vector<unsigned char> &v);
protected:
long size;
FILE *file;
};
#endif // FILE_H