-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile.h
39 lines (33 loc) · 882 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
/*
* Author: Justin Muskopf
* Instructor: Mark Hoffman
* Course: CSCE 4550, Fall 2018
* Assignment: Project 2
*/
#ifndef FILE_H
#define FILE_H
#include <fstream>
#include <string>
#define FILE_SUCCESS 0
#define FILE_FAILED_TO_CLOSE 1
#define FILE_FAILED_TO_OPEN 2
enum FileOpenMode {READ, WRITE};
class File
{
public:
File();
File(std::string fileType);
std::string getContents();
int open(std::string filename, FileOpenMode readWrite = READ);
int openFromInput(FileOpenMode readWrite = READ);
int close();
void setFileType(std::string fileType);
bool isOpen();
int write(std::string buffer);
private:
// Max line length of file
static const int MAX_LINE_LEN = 80;
FILE *file; // The file pointer
std::string type; // The type of the file
};
#endif