Graphics Functions in C

Why can't I see anything when I run my code? I am using 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;
}
+4
source share
1 answer

Your code is correct. The problem is that you are specifying the path to the display driver files "C:\\TC\\BGI". This usually happens because it is tcnot the root file of the mapped drive or the path file used .exethat is not in use c:\\TC. Replace the path with "..//bgi". This will be redirected from bin( to the current working directory ) to bgi.

0
source

Source: https://habr.com/ru/post/1619455/


All Articles