title: opening a rar file by c
body: <p>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.</p>
  
  <p>EDIT:</p>
  
  <p>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?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  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 &gt;C:\stdout.log 2&gt;C:\stderr.log",file2, file));
       getchar();
       return 0;
       }
  </code></pre>