인쇄의 printf와 C의 문자를 인쇄 : 나는 그것을 실행하면 내가못해, 나는 다음과 같은 코드를 한
#include <stdio.h>
#include <string.h>
int main(void)
{
char buff[50];
int pass = 0;
printf("\n Enter the password : \n");
gets(buff);
char str[80];
strcat(str, "nw");
strcat(str, "ww");
strcat(str, "io");
strcat(str, "oi");
char str2[22];
strcat(str2, "jm");
strcat(str2, "qw");
strcat(str2, "ef");
strcat(str2, "io");
strcat(str2, "nw");
strcat(str2, "ce");
strcat(str2, "or");
strcat(str2, "ww");
strcat(str2, "qf");
strcat(str2, "ej");
strcat(str2, "oi");
if(strcmp(buff, str))
{
/* we sf as df er fd xc yyu er we nm hj ui ty as asd qwe er t yu as sd df rt ty qw sd password */
printf ("\n Wrong Password \n");
}
else
{
printf ("\n Correct Password \n");
pass = 1;
}
if(pass)
{
printf ("\n\n\n\n\n\n\n%s", str2);
}
return 0;
}
를 얻을 :
이[email protected]:~# ./root.flag
Enter the password :
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Wrong Password
Segmentation fault (core dumped)
그것은 개행 문자 만의 값이 아닌 저장소를 인쇄 str2. str2를 화면에 인쇄하려면 어떻게해야합니까? 나는 C가 상당히 새롭기 때문에 나는 이것이 작동하지 않는 이유를 전혀 모른다. 내가 간과하는 것은 아마도 단순 할 것 같다.
코드에 '% c'변환 유형 지정자가 없습니다. – Olaf