Conditional if based on command line arguments problem
Hi,
I'm trying to make a program that reads in the command line arguments and depending on what is entered sets mode to either encrypt or decrypt, the problem is it's only doing what is in the else section of the conditional if which means that the conditions for the if statement are incorrect, yet if I do
printf("You have specified that you wish to \"%s\"option",argv[1])
it prints quite clearly that the command entered was for example -e or -d and the check to make sure commands were passed confirms that the appropriate number of commands were passed.
PHP Code:
int main(int argc, char *argv[])
PHP Code:
if (argv[1]=="-d") {
char mode[6]="decrypt";
} else if (argv[1]=="e") {
char mode[6]="encrypt";
} else {
printf("No mode selected");
}
printf("%s",mode);
printf("You have specified that you wish to \"%s\"option",argv[1]);
Any help greated appreciated
thanks