#include <stdio.h> #include <stdlib.h> #include <time.h> #include "tools.h" /**********************************************************/ /**********************************************************/ void clearScreen() { system("clear"); // Linux // system("CLS"); // Windows } /**********************************************************/ /**********************************************************/ void clearBuffer() { char Dummy; do { scanf("%c", &Dummy); } while (Dummy != '\n'); } /**********************************************************/ /**********************************************************/ void waitForEnter() { printf("\nBitte Eingabetaste druecken ..."); clearBuffer(); } /**********************************************************/ /**********************************************************/ int askYesOrNo(char *Question) { char Input; do { printf("%s", Question); scanf("%c", &Input); if (Input != '\n') clearBuffer(); } while ((Input != 'j') && (Input != 'J') && (Input != 'n') && (Input != 'N')); return ((Input == 'j') || (Input == 'J')); } /**********************************************************/ /**********************************************************/ void printLogo () { FILE *titel = fopen("Logo.txt","r"); char output[150]; if(titel) { while(!feof(titel)){ fgets(output,150,titel); printf("%s",output); } puts("\n"); } else { puts("Logo not found\n"); } } /**********************************************************/ /**********************************************************/ void delay(unsigned int number_of_seconds) { // Converting time into milli_seconds int milli_seconds = 1000 * number_of_seconds; // Storing start time clock_t start_time = clock(); // looping till required time is not achieved while (clock() < start_time + milli_seconds) ; } /**********************************************************/ /**********************************************************/ void printLine(char zeichen, unsigned int limit) { for(uint8_t i = 0; i < limit; ++i) { printf("%c",zeichen); } puts("\n"); }