From 579e2eb3f965ae66f188b42771e18e4e4a7b44c8 Mon Sep 17 00:00:00 2001 From: fdai7037 Date: Wed, 8 Feb 2023 19:10:47 +0100 Subject: [PATCH] =?UTF-8?q?Das=20Ablesen=20von=20Zeile=20zu=20Zeile=20wurd?= =?UTF-8?q?e=20eingef=C3=BChrt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Paper-Bin.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Paper-Bin.c b/src/Paper-Bin.c index c9fa602..8bc3c64 100644 --- a/src/Paper-Bin.c +++ b/src/Paper-Bin.c @@ -158,5 +158,14 @@ void sortScoreboard() { system("clear"); FILE *file = fopen("ScoreBoard.txt", "r"); + char line[1000]; + int numberOfLines = 0; + //Die Textdatei wird Zeile für Zeile eingelesen und in die Strukturliste eingefügt + for (int j = 0; fgets(line, sizeof line, file) != NULL && j <= 10; j++) + { + char* playertmp = strtok(line, " "); + strcpy(playerlist[j].Name, playertmp); + } + } } \ No newline at end of file