concierge/challenge/challenge.c

29 lines
564 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
2014-06-07 18:40:16 +02:00
int main() {
int bytes_read;
size_t nbytes = 10;
char **my_string = malloc(sizeof(char**));
char *password = "23door42\n";
puts("Please enter Password: ");
bytes_read = getline(my_string, &nbytes, stdin);
if(bytes_read == -1) {
puts("Error");
return -1;
} else {
if (strcmp(*my_string, password) == 0) {
puts("Success");
return 0;
} else {
puts("How about no?!");
return -1;
}
}
return 0;
}