Console.h
Code: Alles auswählen
#ifndef CONSOLE_H
#define CONSOLE_H
void gotoxy (int x, int y);
void home (void);
void writehead (string header, string filepath);
#endif // CONSOLE_H
Console.cpp
Code: Alles auswählen
#include "Console.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
void gotoxy (int x, int y)
{
printf("\033[%d;%dG", y, x);
}
void home (void)
{
int x[2] = {0,0};
printf("\033[%d;%dG",x[1],x[2]);
}
void writehead (string header, string filepath)
{
FILE *ini;
ini=fopen(filepath.c_str(),"t");
fprintf(ini,header.c_str());
fclose(ini);
}