C command line password
- by Jack Jacobsen
So I'm trying to create a C program where you must input the password on the command line, like
./login password1
And if the password is password1, it'll say something. If not, it prints another message. This is the code I have now:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
if (argc < 2) {
printf("usage: %s <password>\n", argv[0]);
}
char pass = "password";
if (argc == pass) {
printf("Right\n");
} else {
printf("Wrong\n");
}
}
But it wont work.