Does anyone know how to do this?
and also how to change the font color?
Thanks.
Does anyone know how to do this?
and also how to change the font color?
Thanks.
Depends on the system you are trying to blink text within. In old-times on a monochrome screen, you would set the top bit in the text colour attribute and it would automatically blink at approximately 2Hz.
For more modern systems, you actually have to draw the text and then undraw it [or, if you use a VGA style text-screen, you could perhaps change the attribute to be "same text and background colour"].
In a windowed environment, you'd definitely be drawing and erasing the text to make it blink.
As to changing colour, that is the same concept - in VGA/CGA/MGA you can change the attribute that goes with each character, in Windowing mode, you'd be setting the colour before you draw the text.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
How do you draw and undraw it?
Can you give me some example....
Well, that again, depends on the environment you want to do it in.
This will sort of work reasonably portable to a console type application - you may need to adjust the slowdown() numbers to make it right.
I haven't tested that. But anything more advanced would be dependant on the system it's implemented on.Code:void slowdown(int count) { while(--count) { putchar(0); } } int main() { char *s ="Some text"; int i; for(;;) { printf("%s", s); slowdown(1000); putchar('\r'); for(i = 0; i < strlen(s); i++) putchar(' '); slowdown(1000); } }
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I've tested it. One error: 'strlen' : undeclared identifier.
So, what should I do now?
You may need to #include <string.h> and <stdio.h> - the above code wasn't meant to be a "complete compilable file", but rather to show the essential bits.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.