From 7a9064d314495d33837409dfb1513806bc0034c8 Mon Sep 17 00:00:00 2001 From: Yevhen Kozirovskyi Date: Thu, 14 Nov 2024 20:31:59 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20cv7/program.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv7/program.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index 56558cd..2034ca8 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -70,8 +70,13 @@ void znalostny_system(Node *uzol) { } } -int main() { - FILE *file = fopen("baza.txt", "r"); +int main(int argc, char *argv[]) { + if (argc < 2) { + printf("Chyba: zadajte cestu k súboru ako argument.\n"); + return 1; + } + + FILE *file = fopen(argv[1], "r"); if (!file) { printf("Chyba pri otváraní súboru.\n"); return 1; @@ -95,3 +100,4 @@ int main() { uvolni(root); return 0; } +