Guest User

Untitled

a guest
Apr 25th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.49 KB | None | 0 0
  1. void SUWFrame::OnOpenArhive(wxCommandEvent &event) {
  2.     if (ArhiveOpenDialog->ShowModal() == wxID_OK) {
  3.         std::ifstream *arhive_file;
  4.         arhive_file = new std::ifstream((char*)ArhiveOpenDialog->GetPath().mb_str(), std::ios::in | std::ios::binary);
  5.  
  6.         if (arhive_file->is_open()) {
  7.             s_arhive_info *arhive_info = (s_arhive_info*)malloc(sizeof(s_arhive_info));
  8.             arhive_file->read((char*)arhive_info, sizeof(s_arhive_info));
  9.  
  10.             wxString str;
  11.  
  12.             if (arhive_info->is_pswd)
  13.                 str << "Пароль " << arhive_info->pswd << ", ";
  14.             else
  15.                 str << "Без пароля, ";
  16.  
  17.             str << arhive_info->files_count << " файлов, " << arhive_info->version_code << " версия.";
  18.             str << "Size = " << sizeof(s_arhive_info);
  19.             str << "Seek = " << arhive_file->tellg();
  20.  
  21.             wxMessageBox(str);
  22.  
  23.             for (int i = 0; i < arhive_info->files_count; i++) {
  24.                t_onefile *onefile = (t_onefile*)malloc(sizeof(t_onefile));
  25.                arhive_file->read((char*)onefile, sizeof(t_onefile));
  26.  
  27.                str.clear();
  28.  
  29.                str << onefile->fullpath;
  30.                str << "Size = " << sizeof(t_onefile);
  31.                str << "Seek = " << arhive_file->tellg();
  32.  
  33.                wxMessageBox(str);
  34.  
  35.                arhive_file->seekg(arhive_file->tellg()+onefile->size+1);
  36.             }
  37.  
  38.             arhive_file->close();
  39.         }
  40.     }
  41. }
Add Comment
Please, Sign In to add comment