-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSfiles.cpp
56 lines (51 loc) · 870 Bytes
/
Sfiles.cpp
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
#include <string>
#include <fstream>
#include <vector>
using namespace std;
#include "Sfiles.h"
vector <string> inpute_file(string name)
{
vector <string> text;
ifstream file_text;
string text_temp;
file_text.open(name);
if (file_text)
{
while (!file_text.eof())
{
getline(file_text, text_temp);
text.push_back(text_temp);
}
file_text.close();
return text;
}
return text;
}
int file_read (string name)
{
ifstream file_text;
file_text.open(name);
if (file_text)
{
file_text.close();
return 1;
}
else
{
file_text.close();
return 0;
}
return 0;
}
void outpute_file(string name, vector <string> &text, int mode)
{
ofstream out_file;
string text_temp;
if (mode == 2) out_file.open(name, ios_base::app);
else out_file.open(name);
for (int i = 0; i < text.size(); i++)
{
out_file << text[i] << endl;
}
out_file.close();
}