|
>>Actually the only reason I had to use <conio> is to prevent the console program from closing so fast. I believe with Microsoft's compilers you don't have to worry about that cuz they put the line "Press any key to continue" at the end of your output to keep the console window open for you.
That's probably the most common 'problem' with programs that people have when writing for the console. However, it's not even a problem -- the console just closes when the program's done. Instead of adding yet another function to the program, you could always just go to Start->MS-DOS Prompt and then drag the program to the command prompt window and press enter. It will run the program, and the data is still there in the window even after it finished. That's the way to do it, in my opinion.
__________________
% rc4 hexkey < input > output
#define S ,t=s[i],s[i]=s[j],s[j]=t /* rc4 hexkey <file */
unsigned char k[256],s[256],i,j,t;main(c,v,e)char**v;{++v;while(++i)s[
i]=i;for(c=0;*(*v)++;k[c++]=e)sscanf((*v)++-1,"%2x",&e);while(j+=s[i]
+k[i%c]S,++i);for(j=0;c=~getchar();putchar(~c^s[t+=s[i]]))j+=s[++i]S;}
|