Possible Duplicate:
opening a rar file by c
I have to extract a rar file using c code. First I tried out to find the libraries. I got it from http://www.unrarlib.org/. But it was built in 2002. So it do not support the current rar format. Then I checked http://www.rarlabs.com/rar_add.htm. It have libraries but in c++. I don't know anything about c++, So I can't use them. I tried to use the command line tool unrar by using system function. When I used unrar in CMD , It extracted the file but when I used it in C, (command was system("unrar -e -p password protected_file.rar"
);)
It just opened the archieve. It did not extract the file. Now I don't know what to do next? Can anybody suggest me something??
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.
#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;
}