Graphical functions in C

2019-06-28 00:41发布

Why I see nothing when I run my code ? I use DOSBox.

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <bios.h>
#include <ctype.h>
#include <math.h>

int main() {
    int gdriver = DETECT,gmode = 0;
    initgraph(&gdriver,&gmode,"C:\\TC\\BGI");
    struct time t;
    moveto(5,10);
    outtext("Hello");
    moveto(6,11);
    outtext("World**strong text**");
    moveto(1,24);
    outtext("Press: 1-About_Author, 2-Current_Time,ESC to EXIT");
    closegraph();
    return 0;
}

标签: c turbo-c bgi
1条回答
来,给爷笑一个
2楼-- · 2019-06-28 01:08

Your code is right. The problem is with the path you are giving to search for the display driver files "C:\\TC\\BGI". This generally happen because the tc is not root of the mounted drive or the .exe file path you are using is not c:\\TC. Replace the path with "..//bgi". This will redirect from bin(the current working directory) to bgi.

查看更多
登录 后发表回答