Graphical functions in C

和自甴很熟 提交于 2019-12-13 13:29:55

问题


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;
}

回答1:


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.



来源:https://stackoverflow.com/questions/34219457/graphical-functions-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!