This should work.
Best Regards,
Karthigan.
************************************************** **********
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char pass[10]="ded", pass2[10];
printf("Authorization ");
fflush(stdout);
gets(pass2);
if(strcmp(pass,pass2)==0) {printf("success"); exit(0);}
else {printf("error"); exit(EXIT_FAILURE);}
return 0;
}
************************************************** ***********
On Fri, 29 Feb 2008 21:20:43 -0600, Bill Cunningham <>
wrote:
> I have been having fits with this function.
> Can anyone help me I think I need to use if and else if but I have
> rewritten
> it and got errors. I want a conditional in this program a choice between
> 2
> options and only one works. I don't think I need the strcpy either.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
>
> main(){
> char pass[10]="ded", pass2[10];
> printf("Authorization ");
> fflush(stdout);
> fgets(pass,10,stdin);
> strcpy(pass2,pass);
> if(strcmp(pass,pass2)==0) {printf("success"); exit(0);}
> else
> printf("error"); exit(EXIT_FAILURE);}
>
>
--
Using Opera's revolutionary e-mail client:
http://www.opera.com/mail/