# no output for graphics program



## ebindraj (Sep 4, 2008)

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 (Sep 4, 2008)

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

this might help u
simplest c graphics program


----------



## j1n M@tt (Sep 4, 2008)

check whether EGAVGA.BGI file is present...


----------



## krishnandu.sarkar (Sep 4, 2008)

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......!!!!!!!!


----------



## ebindraj (Sep 5, 2008)

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 (Sep 5, 2008)

ebindraj said:


> 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
> 
> *
> ...



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


----------



## krishnandu.sarkar (Sep 5, 2008)

yup sreenidhi88 is rite........

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

"c:\\tc\\bgi\\"


----------



## j1n M@tt (Sep 5, 2008)

"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.


----------



## ebindraj (Sep 7, 2008)

*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 (Sep 7, 2008)

ebindraj said:


> *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 ....
> 
> ...


*
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() 

*



krishnandu.sarkar said:


> i think u havn't enabled ur graphics library.............
> 
> do it frm
> 
> ...


isnt  graphics  nabled by default??



krishnandu.sarkar said:


> i think u havn't enabled ur graphics library.............
> 
> do it frm
> 
> ...


isnt  graphics  nabled by default??


----------



## Garbage (Sep 7, 2008)

lol... 

dude... call getch() before closegraph().


----------



## Faun (Sep 7, 2008)

hahaha...lolz

btw TC sucks


----------



## prasath_digit (Sep 7, 2008)

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. 



T159 said:


> btw TC sucks



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


----------



## QwertyManiac (Sep 8, 2008)

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.


----------



## mehulved (Sep 8, 2008)

QwertyManiac said:


> a compiler warning is always to be listened to, and errors cleared.


 lol


----------

