Need help!! File operations!

Im breaking my head here trying to understand what im supposed to do here... Is what i've done correct?

Here are the instructions:
https://scontent.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/s720x720/11269236_454577871370651_1398710256857180241_n.jpg?oh=a182b829c2f77e7707a48a83d96cde7c&oe=56037299

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
 #ifndef File_H_
#define File_H_
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
#define COUT std::cout<<
#define CIN std::cin
#define ENDL <<endl;
#define IOS std::ios
//#define std::ifstream file_in
//#define std::ofstream file_out
//#define std::fstream file;
#define BUFFER_SIZE 80
#define size 25

class fileclass_
{
public:
	void showstate(fstream & file);
private:
	static int unique_id;
	char * FileName;/*[size*2+1];*/
	streampos CurrentCursorPosition;
public:
	//****falta crear un file
	fileclass_();
	fileclass_(fstream & file);
	fileclass_(const char * filename);
	fileclass_(const fileclass_ & obj);
	~fileclass_();
	streampos Movecursor(int offset_position);//
	streampos Search_data(char * data, int offset_position);
	streampos Search_data1(char * data);
	bool Insert_Data(char * data, int pos);
	bool Append_Data(char * data);
	bool Delete_Data(char * data);
	bool Delete_Data(int amount);
	bool Delete_Data(int offset_position, int amount);
	int Search_and_Replace(char * search, char * replace);
};

#endif

#include"ThirdSin.h"

fileclass_::fileclass_()
{
	static int unique_id = 0;
	FileName = NULL;
	CurrentCursorPosition = NULL;
}
void fileclass_::showstate(fstream & file)
{
	cout << "File status: \n";
	cout << " eof: " << file.eof() << endl;
	cout << " fail: " << file.fail() << endl;
	cout << " bad: " << file.bad() << endl;
	cout << "good: " << file.good() << endl;
	file.clear();
}
fileclass_::fileclass_(fstream & file)
{
	file.open("file.text", IOS::in);
}
fileclass_::fileclass_(const char* FileName)
{
	fstream file;
	strcpy_s(this->FileName, size * 2 + 1, FileName);
	file.open("f1.txt", IOS::in);
}
streampos fileclass_::Movecursor(int offset_position)//
{
	fstream file;
	streampos currentpos;
	file.open("file.text", IOS::in);
	file.seekg(offset_position, ios::end);
	currentpos = file.tellg();
	return file.tellg();
}
streampos fileclass_::Search_data(char * data, int offset_position)
{
	fstream file;
	char ch;
	int ch1, d;
	file.open("file.text");
	file.seekg(offset_position);
	if (file.fail())
		COUT "Error: Couldn't open file " << "file.text" ENDL
	else
	{
		ch = file.get();
		while (!file.eof())
		{
			++ch;
			if (ch >= '0' && ch <= '9')
				++d;
			ch = file.get();
		}
		cout << "There are " << ch1 << "characters " << "in the archive." << endl;
		cout << "There are " << d << " digits in the archive."
			<< endl;
		file.close();
	}
}
streampos fileclass_::Search_data1(char * data)
{
	fstream file;
	file.open(data, IOS::ate);
	streampos SIZE;
	SIZE = file.tellg();
	COUT "File Size is  :" << SIZE ENDL;
	return SIZE;
}
bool fileclass_::Insert_Data(char * data, int pos)
{

}
bool fileclass_::Append_Data(char * data)
{
	fstream file;
	file.open("file.txt", ios_base::app);
	file << data;
}
bool fileclass_::Delete_Data(char * data)
{

}
bool fileclass_::Delete_Data(int amount)
{

}
bool fileclass_::Delete_Data(int offset_position, int amount)
{

}
int Search_and_Replace(char * search, char * replace)
{

}
fileclass_::~fileclass_()
{

}

Topic archived. No new replies allowed.