Browse Source

refactoring: renamed getstr to gets

remotes/origin/userinput
TheUltimateOptimist 11 months ago
parent
commit
f01127845b
  1. 4
      src/userinput.c
  2. 2
      src/userinput.h

4
src/userinput.c

@ -62,7 +62,7 @@ char *readInput() {
return buffer; return buffer;
} }
char *getstr(char *message, unsigned long *minLength, unsigned long *maxLength) {
char *gets(char *message, unsigned long *minLength, unsigned long *maxLength) {
printf("%s", message); printf("%s", message);
fflush(stdout); fflush(stdout);
char *result = readInput(); char *result = readInput();
@ -95,7 +95,7 @@ void printlf(long double value) {
long double getNumber(char *message, long double *min, long double *max, long double *greaterThan, long double *smallerThan, long double leftBorder, long double rightBorder) { long double getNumber(char *message, long double *min, long double *max, long double *greaterThan, long double *smallerThan, long double leftBorder, long double rightBorder) {
while (1) { while (1) {
char *input = getstr(message, NULL, NULL);
char *input = gets(message, NULL, NULL);
if (strlen(input) == 0) { if (strlen(input) == 0) {
printf("%s\n", "Fehlende Eingabe!"); printf("%s\n", "Fehlende Eingabe!");
fflush(stdout); fflush(stdout);

2
src/userinput.h

@ -1,6 +1,6 @@
#ifndef USERINPUT_H #ifndef USERINPUT_H
#define USERINPUT_H #define USERINPUT_H
char *getstr(char *message, unsigned long *minLength, unsigned long *maxLength);
char *gets(char *message, unsigned long *minLength, unsigned long *maxLength);
short gethd(char *message, short *min, short *max); short gethd(char *message, short *min, short *max);
int getd(char *message, int *min, int *max); int getd(char *message, int *min, int *max);
long getld(char *message, long *min, long *max); long getld(char *message, long *min, long *max);

Loading…
Cancel
Save