View Single Post
Old 04-24-2005, 04:39 PM   #10 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,693
redhead is on a distinguished road
Quote:
Originally Posted by rouge
i think the statement i need is soemthing like this :
DisplayWordGame1();
fflush(stdin);
Sorry I didn't see this when I was readign your post, I guess I was more focusing on what you code was doing..
You can't flush stdin with fflush(), it only works on output strams, since stdin is an inuput stream you will need to clear it another way, somethign like this
Code:
int clear_stream(FILE* stream)
{ 
    int input;
    while(input = fgetc(stream))
    {
        if(input == (int)'\n')
        { /* we're at the end of stream */
            return 0;  
        }
       /* its garbadge clugging up stream */;
    }
    /* some error happened reading from stream */
    return -1;
}
but be warned the above code hasn't been tested, it was just somethign I came up with.

I'm too tired now, I have to get some sleep, it's almost 3am here, and I need to get up in another 3 hours.. See you all tomorrow.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote