我知道如何将参数传递给system
,例如:
char words[]="abcde";
sprintf(str, "echo %s",words);
system(str);
我写了一个简单的代码来暴力破解一个rar文件。
但我不知道如何system
在提示出现时传递密码。
我在下面尝试这段代码
char pw[512];
for(int i=0;i<26;i++){
char ch=i+'a';
memset(pw, '\0', sizeof(512));
system("unrar x filename");// prorgam will wait at this point for a password
sprintf(pw, "%c",ch);
system(pw); //this line doesn't make sense....
}
system
当程序等待输入时,如何将该数据传递给?