From 85590d1c6f9448ce9db9be4268268ac011b02db6 Mon Sep 17 00:00:00 2001 From: Peter Wiebe Date: Tue, 6 Feb 2024 18:06:39 +0100 Subject: [PATCH] =?UTF-8?q?Commit=207=20-=20func=20namewahelen=20hinzuf?= =?UTF-8?q?=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/c/hangman.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/c/hangman.c b/src/main/c/hangman.c index 8e3c096..e24e633 100644 --- a/src/main/c/hangman.c +++ b/src/main/c/hangman.c @@ -8,6 +8,7 @@ void protokoll(); void clear_screen(); void willkommen(); int namePruefen(); +void nameWaehlen(); void protokoll(){ clear_screen(); @@ -54,4 +55,23 @@ int namePruefen() { } } fclose(fp); +} + +void nameWaehlen(){ + char name[50]; + + FILE *fp = NULL; + fp = fopen("hangman.txt", "w"); + + clear_screen(); // + printf("Geben Sie den Namen ein: "); + scanf("%s", name); + + char KonfDatei[100]; + snprintf(KonfDatei, sizeof(KonfDatei), "name:%s,level:01", name); + + fprintf(fp, "%s", KonfDatei); + fclose(fp); + + startauswahl(); } \ No newline at end of file