From 5172cb16f46db44270e3bb48739d0eeaf2cac1dc Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Sun, 22 Nov 2020 16:37:04 +0100 Subject: [PATCH] buffet --- cv8/program.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index 242000a..e1bf72d 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -35,13 +35,19 @@ struct tree* read_tree(){ } void search(struct tree* this){ - + + char buffer[5]; memset(buffer,0,5); - char* r = fgets(buffer,5,stdin); + + if(fgets(buffer, 5, stdin) == NULL){ + printf("Koniec vstupu\n"); + return; + } + //char* r = fgets(buffer,5,stdin); int x = strlen(buffer); buffer[x-1]='\0'; - + if(buffer[0] == '\n'){ return; }