From faa46b9f4896efb61082c2144632e9811f85a9a0 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 16 Apr 2020 08:28:29 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu6/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du6/program.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/du6/program.c b/du6/program.c index 5362da8..1f5b7fe 100644 --- a/du6/program.c +++ b/du6/program.c @@ -36,18 +36,9 @@ int main() //int q = 0; size_t pocet_znakov = 0; int antiInfC = 0; - //char r; - + char r = 'a'; while (fgets(line,wSIZE,stdin)) { - - // if (r == '\n') { - // break; - // } - // if(antiInfC == SIZE - 1){ - // break; - // } else{ - // antiInfC++; - // } + k = 0; pocet_znakov = strlen(line); char* all = malloc(pocet_znakov); @@ -62,9 +53,10 @@ int main() pole_smernikov[pm] = all; pm++; } - if((line[0] == '\n' || isalpha(line[0])!=0 ) && antiInfC == 1) { - break; - } + if((line[0] == '\n' || isalpha(line[0])!=0 ) && antiInfC == 1 && r == '\n') { + break; + } + r = line[0]; antiInfC++; } free(line);