-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.h
43 lines (33 loc) · 943 Bytes
/
file.h
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
36
37
38
39
40
41
42
43
#ifndef __FILE_H__
#define __FILE_H__
struct File{
enum open_mode {Read, Write};
File();
explicit File(std::string const &fname, open_mode mode = Read);
~File();
void open(std::string const &fname, open_mode mode = Read);
void close();
open_mode mode() const;
bool opened() const;
bool eof() const;
bool error const;
size_t write(char const &buf, size_t size);
size_t write(std::string const &str);
size_t write(char value);
size_t write(long value);
size_t write(unsigned long value);
size_t write(double value);
size_t read(char *buf, size_t size);
size_t read(std::string &word);
size_t read(char &value);
size_t read(long &value);
size_t read(unsigned long &value);
size_t read(double &value);
size_t readline(std::string &line);
private:
FILE *in;
bool opened;
File(File const &);
void operator=(File const &);
}
#endif