Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/158.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在c+;中创建和压缩嵌套文件的最快方法是什么+;?_C++_Nested_7zip - Fatal编程技术网

C++ 在c+;中创建和压缩嵌套文件的最快方法是什么+;?

C++ 在c+;中创建和压缩嵌套文件的最快方法是什么+;?,c++,nested,7zip,C++,Nested,7zip,我创建这个实用程序是为了创建嵌套文件。 例如,您有一个文件: NEST-0.TXT,其中包含10次“intentials.TXT”。 以及包含“NEST-0.TXT”10次的NEST-1.TXT 因此,当您访问NEST-100.TXT时,您已经创建了 基本上是一个Googol,或10^100个总路径 这是我的密码。我想优化它,以便能够 创建更大的集合。在我的Rasperry Pi 4上,处理1000个文件 在对上一个文件的10000次引用中, 这给出了大约1000^10000个总组合 这是我的密

我创建这个实用程序是为了创建嵌套文件。 例如,您有一个文件: NEST-0.TXT,其中包含10次“intentials.TXT”。 以及包含“NEST-0.TXT”10次的NEST-1.TXT

因此,当您访问NEST-100.TXT时,您已经创建了 基本上是一个Googol,或10^100个总路径

这是我的密码。我想优化它,以便能够 创建更大的集合。在我的Rasperry Pi 4上,处理1000个文件 在对上一个文件的10000次引用中, 这给出了大约1000^10000个总组合

这是我的密码。如何使其多线程或更快?它创造了 动态压缩,在创建时删除每个TXT,这样就不会占用太多空间

  #include <cstdio>
  #include <fstream>
  #include <iostream>
  #include <stdio.h>
  #include <string>

  using namespace std;

  int main() {
    std::string num_files="10", num_repetitions="1000", create_filename, archive_7zip;
    char command[128];
    char filename[] = "NEST-FULLPOWER.ZIP";

    int repnum, filenum, current_filenum;
    std::fstream myfile;

    if (stoi(num_files) > 1) {
      for (filenum = 1; filenum <= stoi(num_files); filenum++) {
    create_filename = "NEST-" + std::to_string(filenum) + ".TXT";
    myfile.open(create_filename, ios::out);

    for (repnum = 1; repnum <= stoi(num_repetitions); repnum++) {
      myfile << "NEST-" + std::to_string(filenum - 1) + ".TXT\r\n";
    }
    myfile.close();

      cout << "Adding File # " << std::to_string(filenum) << " / " << num_files << "\r\n";
      snprintf(command, 128,
               "7z a -mx=9 NEST-FULLPOWER.ZIP NEST-%d.TXT >> logfile.txt", filenum);
      system(command);
      snprintf(command, 128, "rm NEST-%d.TXT", filenum);
      system(command);
      }
    }

    return 0;
  }
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
int main(){
std::string num_files=“10”,num_repetitions=“1000”,创建文件名,存档7zip;
char命令[128];
char filename[]=“NEST-FULLPOWER.ZIP”;
int repnum,filenum,current_filenum;
std::fstream myfile;
如果(stoi(num_文件)>1){

对于(filenum=1;filenum我不认为你可以使它成为多线程的,你可能会从使用zip库并从内存中输入而不是编写文件和调用外部进程中获得更高的性能。所以…你正在创建一个,并且想知道如何有效地执行它吗?我阅读了你的链接。它不是zip炸弹。它是为一个用户设计的我参与的epeater项目,我发现嵌套意图是实现这一点的最有力的方法。