Making The Program Type Slowly

Hello!

I'm kind of new to this C++ stuff and I would like to know whether there is a way that a program can type slowly like it is being typed by a human.

Thanks!
look up nanosleep.
Dear rocketboy9000,

Thanks for your suggestion about nanosleep but when I tried looking up nanosleep, I found a code that I tried on my Visual C++ 2010 Express but there were no changes! Nothing slowed down! Could you please give me a code that works.

Thanks for your help!
This does the trick in windows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <string.h>

#include <windows.h>	

using	namespace	std;

void	outputString(char* str1);

int		main(int argc,char** argv)
{
	outputString("This is a demonstration of slow typing");
}

void	outputString(char* str1)
{
	cout << endl;

	for (int i=0;i<strlen(str1);i++)
	{
		cout << (char) str1[i];
		Sleep(200);
	}

	cout << endl;
}


if you need to run it on linux you will need to delete the windows.h and include
<sys/types.h>
<sys/wait.h>

and change the Sleep function to wait

hope this helps you.
Shredded
Thank you very much shredded! It really does work!
Topic archived. No new replies allowed.