Is there a way to make text appear in dos like a typewriter (eg. one letter appears followed by anorther)
Is there a way to make text appear in dos like a typewriter (eg. one letter appears followed by anorther)
Yes.
Quzah.
Hope is the first step on the road to disappointment.
That's a damn fine question.Originally posted by Granger9
Is there a way to make text appear in dos like a typewriter (eg. one letter appears followed by anorther)
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Two replies and while both are excellent answers, you two really should answer what the OP means instead of what they actually say.
-PreludeCode:#include <stdio.h> #include <time.h> static void pause ( int ticks ) { clock_t end, current = clock(); end = current + ticks; while ( current < end ) current = clock(); } int main ( void ) { int i; char *text = "This is a test"; for ( i = 0; text[i] != '\0'; i++ ) { (void)putchar ( text[i] ); pause ( 200 ); } (void)getchar(); return 0; }
My best code is written with the delete key.
You just make things tooo easy Prelude..Originally posted by Prelude
Two replies and while both are excellent answers, you two really should answer what the OP means instead of what they actually say.
<snip>
-Prelude
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
I get most of that...I think...but can someone explain in a little more detail how clock_t works, I have looked at it in my compilers index but it didn't help me all that much.
-Microsofts Visual C++ Introductory Kit-
Current Projects: Learning Everything C.
Everyone has a photographic memory, some people just don't have any film.
______________________________
When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth
here's another way:
if delay doesn't work with your compiler, useCode:void typeline() { int i; char line[]="-----------------------------------------------------------"; for (i=0; line[i]; i++) { printf("%c", line[i]); delay(10); } printf("\n"); }
this
and say my_delay(somenumberhere)Code:void my_delay (int milliseconds) { time_t end, now = clock(); for ( end = now + milliseconds; now < end; now = clock() ) continue; }
Originally posted by CAP
I get most of that...I think...but can someone explain in a little more detail how clock_t works, I have looked at it in my compilers index but it didn't help me all that much.clock()
return the number of clock ticks used by the program
Synopsis:
#include <time.h>
clock_t clock(void);
Description:
The clock() function returns the number of clock ticks of processor time used by the program since it started executing. This can be converted to seconds by dividing by the value of the macro CLOCKS_PER_SEC.
Returns:
the number of clock ticks that have occurred since the program started executing
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Thanks Hammer...that sounds somewhat familar . O well, I guess it is back to good old trial and error, thanks anyways.
-Microsofts Visual C++ Introductory Kit-
Current Projects: Learning Everything C.
Everyone has a photographic memory, some people just don't have any film.
______________________________
When was the last time you went for a colon cleansing? Because quite frankly, you're so backed up with crap that it's spilling out your mouth