Hello. I was making a command line xor encryption tool (mainly for fun), and I did most of it pretty good. But when I compile it (without any errors or warnings), and then run it with the nessesary arguments, it throws a invalid page fault at me. :(
Well here is a snippet of the code (a bit large to post the entire thing...):
Now what do I do? :pCode:void fSyntax() { cout << "\nThe correct syntax is: <filename> <password> [--decrypt]\n"; exit(1); } int main(int argc, char *argv[]) { int i; if((argc < 2) || (argc > 3)) fSyntax(); while( i < argc ) { if(!strcmp(argv[argc],"--decrypt")) { fstream FileD(argv[1], ios::in | ios::out | ios::nocreate); if(!FileD) exit(1); fDecrypt(FileD, argv[2]); FileD.close(); exit(1); } i++; } fstream FileE(argv[1], ios::in | ios::out | ios::nocreate); if(!FileE) exit(1); fEncrypt(FileE, argv[2]); FileE.close(); return 0; }
I'm thinking it has something to do with the while() loop, but I can't be sure on that.
Well, thanks for your help.



LinkBack URL
About LinkBacks


