Add solution for eingabe.

This commit is contained in:
paulusja committed 2026-10-15 11:30:42 +02:00
1 parent 62f5e66043
commit 4500d1752e
2 files changed
+26

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#include "eingabe.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int gibTextEin(const char *promptText, char *puffer, unsigned int maxLen)
{
if(fgets(puffer, maxLen, stdin) == NULL)
return 0;
else
{
if(puffer[strlen(puffer)-1] == '\n')
puffer[strlen(puffer)-1] = '\0';
else
while(getchar() != '\n') {}
return 1;
}
}
+6
View File
@@ -0,0 +1,6 @@
#ifndef EINGABE_H
#define EINGABE_H
int gibTextEin(const char *promptText, char *puffer, unsigned int maxLen);
#endif