tags:

views:

38

answers:

2

The text should blink in red color but its not blinking

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main(void)
{
    int driver=DETECT,mode,mx,my,x1,y1,x2,y2;
    initgraph(&driver,&mode,"C:\\tc\\bgi");
    cleardevice();
    mx=getmaxx();
    my=getmaxy();
settextstyle(0,HORIZ_DIR,6);
setcolor(RED+BLINK);
outtextxy(mx/2,my/2,"FAHAD");
    getch();
    closegraph();





}
+1  A: 

From your question I have no clue what library you are using, but common sense tells me this could help:

setcolor(RED | BLINK);  // Use bitwise or instead of + to combine values
dark_charlie
Generally this is good advice but in this case these are mutually exclusive bit flags, so + and | would generate the same result.
Clifford
+1  A: 

That code is targeted at 16-bit MS-DOS, the Win32 DOS-box virtualisation does not support the blinking attribute. I believe that it was supported in 'full-screen' mode, but versions of Windows since XP and 2000 do not support full-screen console or DOS-box presentation.

Clifford
Which should be considered a good thing X-D
Axel Gneiting
I am using turbo C compiler(16bit). So it wont work on it?
fahad
@fahad: No, that ancient compiler should have been retired long ago! There is an extended Win32 clone of Borland's BGI (http://codecutter.org/tools/winbgim/), that would allow you to use this interface with a modern compiler and 32bit code. However for the same reasons it does not support BLINK either (it does not even define it). For this obsolete code to work you'd need to install a genuine MS-DOS or clone, or Windows 95/98 or Me, but that is a sledgehammer to crack a nut and would cripple your PC!
Clifford
The second and fourth paragraphs here: http://en.wikipedia.org/wiki/Win32_console#Details are relevant.
Clifford