Thread: Create a flashing text

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    45

    Create a flashing text

    So i have to create a document where all the text is normal, but on the sides one word, a important word flashes...

    how would i code that in c ?????????

    oh yeah i am useing complier Bloodshed Dev C++ on windows 7

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Quote Originally Posted by LAMER_CODER View Post
    So i have to create a document where all the text is normal, but on the sides one word, a important word flashes...
    What do you mean with "create a document"? What document format are you talking about?

    Bye, Andreas

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    45
    no like an output screen with text on it like this


    ALERT!!! There may be a snowstorm tonight ALERT!!!

    where the 2 ALERT!!! are flashing

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by LAMER_CODER View Post
    no like an output screen with text on it like this


    ALERT!!! There may be a snowstorm tonight ALERT!!!

    where the 2 ALERT!!! are flashing
    Your console can print in several colors, AND in "blinking" mode (what you call flashing).

    It's not part of C, but you can do it in C, using either a non-standard header (conio.h), or ncurses, or if you are in Windows, you call do it using the windows.h header.

    Does your compiler support conio.h, or do you have ncurses, or use Windows?

    You can make text flash also, simply by printing it, then overwriting it so it disappears, and then printing it in the same position again. That can be done using standard C.

    For an alert however, a nice red or yellow color would be nice, wouldn't it?

    So:

    conio.h
    ncurses
    or
    windows.h

    are your best choices.

  5. #5
    Registered User
    Join Date
    Feb 2013
    Posts
    45
    yeah i use windows and i thinkmy complier supports conio.h
    so wat now

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Check it to be sure it supports conio.h:

    Code:
    #include <stdio.h>
    #include <conio.h>
    
    
    int main(void) {
       gotoxy(10,10);
       printf("OK\n");
       return 0;
    }
    copy paste, and compile that. When you run it, if it moves the cursor to line 10, column 10 then you have conio.h. If it gives you an error and won't compile, then you don't have it.

    You need to change gotoxy() to _gotoxy(), if you are using Pelles C on Windows.

  7. #7
    Registered User
    Join Date
    Feb 2013
    Posts
    45
    it says that gotoxy() / _gotoxy() is undeclared
    so........

  8. #8
    Registered User
    Join Date
    Feb 2013
    Posts
    45
    how would i change the colour of the ALERT to alternate b/w red and yellow and not the entire sentence, just the ALERT

    how???

  9. #9
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    It sounds like curses would be best suited for this task. Install either ncurses or PDcurses as they both work in Windows. Then you need to take it step by step by writing a message in a specific color in a specific spot on the terminal, then introducing a delay, then writing it again in a different color, etc... there is no built-in function to flash text in different colors, you have to implement this yourself.

  10. #10
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Sounds to me like you want to produce an html doc with the equivalent* of the dropped 'blink' tag.

    * By equivalent, I mean one can use javascript to the same effect.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Flashing Text in Linux Terminal
    By gemera in forum Linux Programming
    Replies: 8
    Last Post: 01-17-2013, 02:51 PM
  2. Flashing text
    By Queatrix in forum C++ Programming
    Replies: 5
    Last Post: 04-10-2005, 09:32 PM
  3. flashing text in c++
    By tetraflare in forum C++ Programming
    Replies: 4
    Last Post: 11-27-2002, 07:06 PM
  4. Is it possible to create flashing text?
    By wolzi in forum C++ Programming
    Replies: 2
    Last Post: 05-07-2002, 08:53 PM
  5. create a text file with data using text editor
    By fried egg in forum C Programming
    Replies: 3
    Last Post: 03-14-2002, 09:11 PM