All pastes #813366 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-12 14:03 UTC
rendered paste body
/* #####  libraries.h ##### */

#include <stdio.h>
#include <stdlib.h>
#include <termios.h> 
#include <unistd.h>

#ifdef WIN32
	#define clear_screen "cls"
#else
	#define clear_screen "clear"
#endif

char mainmenu();
void eksodos();

int getch(void);


FILE *dataf;
FILE *indexf;

int getch(void) 
{
  struct termios oldstuff;
  struct termios newstuff;
  int    inch;
  tcgetattr(STDIN_FILENO, &oldstuff);
  newstuff = oldstuff;                  /* save old attributes               */
  newstuff.c_lflag &= ~(ICANON | ECHO); /* reset "canonical" and "echo" flags*/
  tcsetattr(STDIN_FILENO, TCSANOW, &newstuff); /* set new attributes         */
  inch = getchar();
  tcsetattr(STDIN_FILENO, TCSANOW, &oldstuff); /* restore old attributes     */
  return inch;
}

char mainmenu(){
	system(clear_screen);
	printf(".------------| Main menu |------------.\n");
	printf("|                                     |\n");
	printf("|  1. Dhmiourgia / Epektash           |\n");
	printf("|  2. Anazhthsh                       |\n");
	printf("|  3. Probolh                         |\n");
	printf("|  4. Diorthosh                       |\n");
	printf("|  5. Anasigkrothsh                   |\n");
	printf("|  6. Eksodos                         |\n");
	printf("|                                     |\n");
	printf("|-------------------------------------'\n");
	printf("|  Epilogh :                          |\n");
	printf("'-------------------------------------'\n");
	return getch();
}

void eksodos(){
	system(clear_screen);
	printf(".------------|  Eksodos  |------------.\n");
	printf("|                                     |\n");
	printf("|   Organwsh kai diaxeirhsh arxeiwn   |\n");
	printf("|               Project               |\n");
	printf("|                                     |\n");
	printf("|                                     |\n");
	printf("|  XXXXXXXXXXXXXXXXXX     T-1786      |\n");
	printf("|  XXXXXXXXXXXXXXXXXXXX   T-1800      |\n");
	printf("|                                     |\n");
	printf("'-------------------------------------'\n");
	getch();
	system(clear_screen);
	return;
}