Need some advice here:
I have a school project where I need to learn how to open read and write a compressed file to a directory on the computer>
So, far I have got this far with my code.
#include <iostream>
#include <fstream>
#include <iomanip>
#include <ostream>
#include <string>
using namespace std;
int main(void){
ofstream ofile;
ofile.open ("master.rez");
if(ofile.is_open()){
std::cout << ofile << "this line will be written into master.rez."<< endl;
std::cout << ofile << "this line also will be written into master.rez."<< endl;
system("pause");
ofile.close();
}else{
cerr<<"Error opening file!!"<<endl;
}
string buf;
ifstream ifile;
ifile.open("master.rez");
if(ifile.is_open()){
while(getline(ifile,buf))
cout<<buf;
ifile.close();
}else{
cerr<<"Error opening file!!"<<endl;
}
return 0;
}
So, there is my code I can open the compressed file and read it then open it again with "ifstream" and write the whole compressed file to my directory but I need to be able to read all the files inside of the compressed file and then use "ifstream" to write all the files from the compressed file to the directory like extracting them.
What, is the steps I need to take now in order to do this.
And, also for future terms if I wanted to do this with any compressed file type as long as its not encrypted how and what are the steps for that as well That I need to take thanks. Any help I get is gratefully appreciated.
What I have tried:
I've, got my program to open read and write the entire "master.rez" file to my directory where the "exe" is stored but I need to be able to open the compressed "master.rez" file and read it and write all the files inside of the compressed file aka "master.rez" to my directory where my "exe" is stored.