Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mad
concierge
Commits
efc93bdc
Commit
efc93bdc
authored
Jun 07, 2014
by
gnomus
Browse files
Added little c-Script to ask for a Password
parent
2a810471
Changes
1
Hide whitespace changes
Inline
Side-by-side
challenge/challenge.c
0 → 100644
View file @
efc93bdc
#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
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment