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;
}
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 thetc
is not root of the mounted drive or the.exe
file path you are using is notc:\\TC
. Replace the path with"..//bgi"
. This will redirect frombin
(the current working directory) to bgi.