Commit efc93bdc authored by gnomus's avatar gnomus
Browse files

Added little c-Script to ask for a Password

parent 2a810471
#include <stdio.h>
#include <stdlib.h>
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 {
puts(password);
puts(*my_string);
if (strcmp(*my_string, password) == 0) {
puts("Success");
return 0;
} else {
puts("How about no?!");
return -1;
}
}
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment