Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

EDIT:

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. EDIT: 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;
     }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
972 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...