Is there any method in C that let me make a string which disappears and appears after a specific time (time which I will determine during programming).
Is there any method in C that let me make a string which disappears and appears after a specific time (time which I will determine during programming).
I suppose you could do
Then do something likeCode:printf("hello");fflush(stdout);
And repeat as necessary with time intervals.Code:printf("\b\b\b\b\b \b\b\b\b\b");fflush(stdout);
If you want anything more refined, you need to say which OS/Compiler you're using.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I'm using Windows 7 Ultimate 64bit. The compiler is gcc.
I didn't get how the above works. It's because it's the first time that I have to deal with fflush().
Could you either explain to me the above code and how it works, or describe to me another method?
> I didn't get how the above works.
But you've only had at most 10 minutes to figure that out.
> It's because it's the first time that I have to deal with fflush().
Interesting - have you heard of manual pages or google?
> Could you either explain to me the above code and how it works, or describe to me another method?
Could do - but I'm not going to.
Not until you've at least posted YOUR attempt at actually trying to use that information, and reported on what you found.
Frankly, throwing it back at me after only 10 mins makes me wonder why I bothered.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I've already opened some tabs and I'm reading about stream and files in general, because fflush() has actually to do with files. I just asked for another way of doing this thing, not because I'm bored of studying on my own, but because I was wondering if it is possible to be dealt without the knowledge of FILES in C. Don't be so critical of me.
P.S. I've created a simple version of the game connect-four as an excercise for my university and I just want to make the announcement of the winner more spruce. It's not that I want just a solution to my problem.I've only asked for a possible way of doing this without using stream and fflush() but that's ok.
Last edited by Cevris; 05-03-2011 at 04:40 AM.
I think you can try
Code:LOOP: printf("Hello"); sleep(100); system("cls"); sleep(100); goto LOOP;