开发者

gotoxy function in turbo c

How can I set x and y in Based on pix开发者_开发技巧el in gotoxy(x,y) function?


gotoxy is not part of Pascal - it's an extension found in some implementations of Pascal and is probably implemented in a library. For C you can get similar results using a library such as ncurses.


You cannot. The console is only a two-dimensional buffer of character cells and you can set the cursor to one of those cells. They have no relationship to the pixels that may be used to draw the characters.


gotoxy() is character oriented (and only works in MS-DOS character mode). You cannot draw a character at a specific pixel position using gotoxy() and you cannot do it in character mode in any case.

Support for 16 bit MS-DOS applications using graphics modes is limited and troublesome on modern Windows systems. You would do better to discard your 30 year old compiler and use something that will directly target the actual OS you are running on! You can then create an application that uses a graphics window and GDI calls (or any number of higher level APIs) to draw text at any position, any size, and any font.


Roughly like this.

#include <conio.h>

int main(void) 
{
    int x = 3;
    int y = 4;
    gotoxy(x, y)

    return 0; 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜