Windows 10 Question about Compressed Files for school project

  • Thread starter Thread starter kingnoger1001
  • Start date Start date
K

kingnoger1001

Guest
I 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;

// Opening file for writing

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;

// Opening file for reading

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.

More...
 
Back
Top