Oppure

Loading
21/07/11 10:34
comina8
Se sei su Windows:
#include <windows.h>
void GoToxy(unsigned char x, unsigned char y)
{
	HANDLE hStdout;
	CONSOLE_SCREEN_BUFFER_INFO csbiInfo;

	hStdout=GetStdHandle(STD_OUTPUT_HANDLE);
	if (!GetConsoleScreenBufferInfo(hStdout,&csbiInfo))
		MessageBox(NULL,"GetConsoleScreenBufferInfo","Console Error",MB_OK);
	csbiInfo.dwCursorPosition.X=x;
	csbiInfo.dwCursorPosition.Y=y;
	if (!SetConsoleCursorPosition(hStdout,csbiInfo.dwCursorPosition))
		MessageBox(NULL,"SetConsoleCursorPosition","Console Error",MB_OK);
}
void ClearScreen(void)
{
        system("cls");
}


Se sei su Linux:
#include <unistd.h>
void GoToxy(unsigned char x, unsigned char y)
{
	char Str[1]={0};

	x++;
	y++;
	sprintf(Str,"3[%d;%df",y,x);
	printf("%s",Str);
}
void ClearScreen(void)
{
        system("clear");
}


Poi creando due thread ti posizioni con uno a gotoxy(0,2); per l'input
e a gotoxy(0,20); per l'output (anche senza creare thread dipende
da cosa vuoi fare te...).

Chiedo scusa se il topic è un po' vecchio...
aaa