From f7276b6c986bde2f8218aceebab3a9b7767ad463 Mon Sep 17 00:00:00 2001 From: Kozar Date: Wed, 2 Oct 2024 17:06:57 +0000 Subject: [PATCH] Initializacia --- cv1/program.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cv1/program.c b/cv1/program.c index be31ec9..69dddbf 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -54,7 +54,12 @@ int read_pizza(struct pizza *item) { return 0; } - item->price = strtof(line, NULL); + char *endptr; + item->price = strtof(line, &endptr); + if (endptr == line || *endptr != '\n') { + return 0; + } + return 1; }