challenge.c 568 Bytes
Newer Older
1
2
3
#include <stdio.h>
#include <stdlib.h>

gnomus's avatar
gnomus committed
4
int main() {    
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    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;
}