C Programming Question-Flash Character in stdout

Discussion in 'Computer Gaming Forum' started by PhantasyStar, May 28, 2007.

  1. PhantasyStar

    PhantasyStar Well Known Member

    Joined:
    Jul 11, 2004
    Messages:
    1,551
    Likes Received:
    19
    Basically, I want to know the function that allows you to remove a character put on the console. For instance, if I take the character 'X' and use putc('X', stdout), it puts the character on the stdout console, but I want to remove that character now to where it is nothing, so I can create an infinite while that will have the character flash. Any help would be great, thanks.
     
  2. marshallh

    marshallh N64 Coder

    Joined:
    Mar 16, 2006
    Messages:
    661
    Likes Received:
    26
    Try printing ASCII code 8 (backspace).

    putc((char)8,stdout);
     
  3. PhantasyStar

    PhantasyStar Well Known Member

    Joined:
    Jul 11, 2004
    Messages:
    1,551
    Likes Received:
    19
    Thanks, I used that to backspace, and then putc(NULL, stdout) and it worked fine, thanks again.
     
  4. PhantasyStar

    PhantasyStar Well Known Member

    Joined:
    Jul 11, 2004
    Messages:
    1,551
    Likes Received:
    19
    Here's what I got to make it work:

    #include <stdio.h>

    int main()
    {
    int temp = 0;
    while(temp < 10000)
    {
    putc('X', stdout);
    putc((char)8, stdout);
    putc(NULL, stdout);
    putc((char)8, stdout);
    temp++;
    }
    }
    Unfortunately, I have to figure out how to make a delay between flashes, but I got the flash working.
     
  5. klarth

    klarth Rapidly Rising Member

    Joined:
    Mar 22, 2006
    Messages:
    80
    Likes Received:
    0
    another thing you can do is to use the escape character \b Either way, does the same thing.
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page