The two functions below are about to implement zip and unzip, but I have problems selecting the correct type buffer to save the string from the file.
Also, for char* ptr = line, which is declared a pointer to point to the string line, it returns me an error.
Unzip function is the kinda same problem.
Error :error: cannot convert ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘char*’ in initialization
//zip function
int main(int argc, char*argv[])
{
  if(argc == 1){
    return 0;
  }
  string line;
  // char *line = new char[SIZE];
  for(int i = 1; i < argc; i++){
    ifstream file(argv[i]);
    if(file.fail()){
      cerr << "wzip: cannot open file" << endl;
      return 1;
    }
    while(getline(file,line)){
      char *ptr = line;
      char current = *ptr;
      unsigned int count = 0;
      while(*ptr){
        if(*ptr == current){
          count++;
          ptr++;
          continue;
        }else if(count == 4294967295){
          cout << count << current;
          current = 0;
          count = 0;
        }else{
          cout << count << current;
          current =*ptr;
          count = 0;
        }
      }
    }
    cout << endl;
    file.close();
  }
  return 0;
}
//unzip function
int main(int argc, char* argv[])
{
  if(argc == 1){
    return 0;
  }
  char buffer;
  for(int i = 1; i < argc; i++){
    ifstream file(argv[i]);
    if(file.fail()){
      cerr <<"wunzip: cannot open file" << endl;
      return 1;
    }
    while(getline(file,line)){
      char *ptr = buffer;
      unsigned int count = 0;
      while(*ptr != 0){
        if(*ptr <='9' && ptr >= 0){
          count = count*10+(*ptr-'0');
        }else{
          while(count--){
            cout << *ptr;
            count = 0;
          }
        }
        ptr++;
      }
    }
    cout << endl;
    file.close();
  }
  return 0;
}
 
     
    