Working with files inside zip folders


Hi, I have been working with C++ for the past few months and I have recently been working on a program to search for a string in a text file, and replace that string with a new string. I have tested the program with some text files and it works. However, the file that I will be using in practice will be inside a zip folder, and I get errors whenever I try to open a file that is in a zip folder.

How can I get inside a zip folder to edit a text file? I think I have to use a library, but I have no experience downloading or using new libraries. I am making this code in visual studio if that helps.
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
  #include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>


using namespace std;
int main()
{
	ifstream infile;
	ofstream outfile;
	infile.open("D:\\make1.txt");
	outfile.open("D:\\make2.txt");

	string str2 = "true,";
	string str[1000];
	size_t found;
	int pos[1];
	int a = 0;



	for (int i = 0; i < 1000; i++) {
		getline(infile, str[i]);
	}
	for (int i = 0; i < 1000; i++) {
		found = str[i].find("\"doRaft\": false,");
		if (found != string::npos) {
			pos[0] = found;
			a = i;
		}
	}
	cout << a << endl;
	cout << str[a] << endl;
	str[a].replace(18, 22, str2);
	cout << str[a] << endl;

	for (int i = 0; i < 1000; i++) {
		outfile << str[i] << endl;
	}

	infile.close();
	outfile.close();
	return 0;
}
Topic archived. No new replies allowed.