用c打开一个rar文件 [英] opening a rar file by c

查看:128
本文介绍了用c打开一个rar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须用C编写代码以在Windows中提取受密码保护的rar文件。我不知道该怎么做。有人可以给我一些建议或提供示例代码吗?我将非常感谢。

I have to write code in C to extract a password protected rar file in windows. I don't have any clue about how to do this. can anybody suggest me something or provide a sample piece of code? I will be very thankful.

编辑:

这是我用来打开rar文件的代码在系统命令中,ranjit是密码。在模块+文件名中给出了错误undefined symbol_system。有谁能够帮助我??自两天以来,我一直在为此奋斗。
编辑:此代码打开存档,但不提取它。如果我在命令行中使用unrar命令,它将提取文件。我该怎么办?

This is the code I am using to open the rar file.In the system command ranjit is the password. It's giving the error undefined symbol_system in module+thefile name. Can anybody help me?? I am struggling on this since two days. This code opens the archive but do not extract it. If I uses the unrar command in command line, it extracts the file. What I should I do?

#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

In addition to what karlphilip's suggestions there's also a couple of potentialliy interesting looking resources at http://www.rarlabs.com/rar_add.htm.

特别是我认为 UnRAR.dll UnRAR源可能相关。不过,我真的无法检查一下。

In particular I am thinking UnRAR.dll and UnRAR source may be relevant. I can't really check it out at the momment though.

这篇关于用c打开一个rar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆