gotoxy function with C ( linux/unix )

前端 未结 3 1133
眼角桃花
眼角桃花 2021-01-03 09:56

I am making a terminal software like GNU MC and I need gotoxy foo, but it has to be in C. It can be in macro or in C, but not in ASM code because I don`t know ASM. Any bit o

3条回答
  •  感动是毒
    2021-01-03 10:53

    Hope this snippet works with you.

    I found these snippet on google long ago. I just saved it on my disk, now after seeing your post I just opened it.

    Code

    #include 
    #include 
    
    void gotoxy(int x,int y)
    {
        printf("%c[%d;%df",0x1B,y,x);
    }
    
    int main(void)
    {
        gotoxy(10,10);
        printf("hello world");
        return 0;
    } 
    

提交回复
热议问题