gotoxy與clrscr這兩個function在TurboC++編譯器內可以正常的使用!但是用DevC++卻發生未定義的Error.... 今天上網找到人家寫好的function...試過的確可以使用~

#include
void gotoxy(int xpos, int ypos);
void clrscr(void);
//////////////////////////////////////////////////////////////////
void gotoxy(int xpos, int ypos)
{
  COORD scrn;   

  HANDLE hOuput = GetStdHandle(STD_OUTPUT_HANDLE);

  scrn.X = xpos; scrn.Y = ypos;

  SetConsoleCursorPosition(hOuput,scrn);
}
//////////////////////////////////////////////////////////////////
void clrscr(void)
{
    CONSOLE_SCREEN_BUFFER_INFO sbinf;
    int size;
    COORD scrn = {0, 0};
    HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hStdOut, &sbinf);
    size = (sbinf.srWindow.Right-sbinf.srWindow.Left+1)*
        (sbinf.srWindow.Bottom-sbinf.srWindow.Top+1);
    FillConsoleOutputCharacter(hStdOut, 32, size, scrn, NULL);
}
//////////////////////////////////////////////////////////////////
 
關鍵字: DevC++ + gotoxy
arrow
arrow
    全站熱搜

    和風信使 發表在 痞客邦 留言(0) 人氣()