no output for graphics program

Status
Not open for further replies.

ebindraj

Right off the assembly line
i don't get any output for even a simple program like drawing a line:((i even tried the default example program in graphics)

whenever i run the program a blank screen appears
i have checked BGI files and all the required files are found...but still the problem persists
i get output for normal C programs(without graphics)

please please help me at the earliest
 

sreenidhi88

Journeyman
reinstall turbo c and try again.why dont you submit your program here.

this might help u
simplest c graphics program
 

krishnandu.sarkar

Simply a DIGITian
Staff member
Posted by: sreenidhi88
#include<stdio.h>
#include<conio.h>
#include<graphics.h>

int main()
{
int gd=DETECT,gm;
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");
circle(10,20,30);
getch();
}



i think u havn't enabled ur graphics library.............

do it frm

OPTIONS>LINKER>LIBRARY and check GRAPHICS LIBRARY option thr...........

if u do not enable GRAPHICS LIBRARY.............none of ur graphics prog will work......!!!!!!!!
 
OP
E

ebindraj

Right off the assembly line
buddy i have enabled the graphics library but still there is no output only a blank screen only appears
i'm posting the program as u said



#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, " ");
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}

i tried this one also
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "C:\TC\BGI ");
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}

 

sreenidhi88

Journeyman
buddy i have enabled the graphics library but still there is no output only a blank screen only appears
i'm posting the program as u said



#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, " ");
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}

i tried this one also
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "C:\TC\BGI ");
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}


i think you didnt read the link i gave.if c:\tc\bgi doesnt work try c:\\tc\\bgi.
 

krishnandu.sarkar

Simply a DIGITian
Staff member
yup sreenidhi88 is rite........

"c:\tc\bgi doesnt work try c:\\tc\\bgi."

"c:\\tc\\bgi\\"
 
Last edited:

j1n M@tt

Cyborg Agent
"c:\\tc\\bgi" will work.....or copy all necessary bgi files to the 'bin' directory of TC, or to the location where the C pgms r saved.
 
OP
E

ebindraj

Right off the assembly line
Buddy as u told me i copied all BGI files to BIN ..but stll no output comes only a blinking cursor is seen:(

this is the pgm ....



#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "C:\\TC\\BGI ");//(i tried C:\\TC\\BIN also):(
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}
 

sreenidhi88

Journeyman
Buddy as u told me i copied all BGI files to BIN ..but stll no output comes only a blinking cursor is seen:(

this is the pgm ....



#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "C:\\TC\\BGI ");//(i tried C:\\TC\\BIN also):(
setcolor(2);
line(100,200,250,200);
closegraph();
getch();
}

no need of this step (i tried C:\\TC\\BIN also)

come back to C:\\TC\\BGI
dude you have any idea what closegraph() does??
and does it make any sense to call it before getch()??
your graphics program is working as expected.
use
C:\\TC\\BGI itself
just thinkover once again about the sequence in which you call closegraph and getch() :razz::)
:)


i think u havn't enabled ur graphics library.............

do it frm

OPTIONS>LINKER>LIBRARY and check GRAPHICS LIBRARY option thr...........

if u do not enable GRAPHICS LIBRARY.............none of ur graphics prog will work......!!!!!!!!
isnt graphics nabled by default??:confused:

i think u havn't enabled ur graphics library.............

do it frm

OPTIONS>LINKER>LIBRARY and check GRAPHICS LIBRARY option thr...........

if u do not enable GRAPHICS LIBRARY.............none of ur graphics prog will work......!!!!!!!!
isnt graphics nabled by default??:confused:
 
Last edited:

prasath_digit

prasath->loves(APPLE);
I tried ur prg in VC++ 2008 Express, but it looks like it doesn't support BGI graphics like TC( no "graphics.h" header file in the "C:\Program Files\Microsoft Visual Studio 9.0\VC\include" dir ). Currently i don have any other compiler installed on my PC, tommorow i'll try it on my friend's PC and post my solution. :)

btw TC sucks

Although, I also suggest Dev-C++ and VC++ 2008 Express Edition compilers, TC is the best choice for Simple programming. :)
 
Last edited:

QwertyManiac

Commander in Chief
Its not about the tool, its about the compiler that drives it and no matter how simple the code is, a compiler warning is always to be listened to, and errors cleared.
 
Status
Not open for further replies.
Top Bottom