我必须用 C 语言编写代码才能在 Windows 中提取受密码保护的 rar 文件。我不知道如何做到这一点。有人能给我建议或提供一段示例代码吗?我将非常感激。
编辑:
这是我用来打开rar文件的代码。系统命令中的ranjit是密码。它给出了模块+文件名中 undefined symbol 系统错误。有谁能够帮助我??两天以来我一直在努力解决这个问题。 编辑:此代码打开存档但不提取它。如果我在命令行中使用 unrar 命令,它会提取文件。我该怎么办?
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char **argv)
{
char file[20];
char file2[50] = "F:\\Program Files\\WinRAR\\unrar.exe";
printf("enter the name of the rar file : ");
gets(file);
puts(file);
system(("%s e -p ranjit %s >C:\stdout.log 2>C:\stderr.log",file2, file));
getchar();
return 0;
}
最佳答案
除了 karlphilip 的建议之外,http://www.rarlabs.com/rar_add.htm 上还有一些可能很有趣的资源。 .
我特别认为UnRAR.dll和UnRAR源可能是相关的。不过我现在还不能真正检查它。
关于c - 用c打开rar文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3514854/