我正在做一个像GNU MC这样的terminal软件,我需要gotoxy foo,但是它必须是C语言的。它可以是macros或者C语言,但是不能用于ASM代码,因为我不知道ASM。 任何位操作符都可以使用,但我不知道如何伪代码或如何开始这样做。 任何意见将不胜感激:)
看到这个函数的ncurses库
你需要从这里列出的一些功能
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/printw.html#PRINTWCLASS
#include<stdio.h> #include<stdlib.h> void gotoxy(int x,int y) { printf("%c[%d;%df",0x1B,y,x); } \\ try it out int main() { gotoxy(10,10); printf("hello world"); } it works .
希望这个片段能和你一起工作。 我很久以前在google上发现了这些片段。 我只是把它保存在我的磁盘上。 现在看到你的帖子后,我刚打开它
这个功能是否足够?
void gotoxy(int x, int y) { printf("You are now at position (%d, %d). You"\ " look around and you see a vast emptiness...", x, y); }
但是,你提到你正在使用像GNU MC(午夜指挥官?)这样的软件,所以也许你的意思更像是:
void goto_url(char* url) { ... code here... }