Anyone knows how to print a string sequentially.
Basically, i made an application (with a GUI) and i want on the screen to print out a string sequentially.
For example: Lets say:
String str = "Hi my name is Mans";
What i would like to do is to print out the string str, character by character with a timer after each character printed out.
See the printing output is the same way as we are writing on the keyboard.
For example, i wanna print out "Hi my name is mans"
So the output is gonna be like:
H (timer = 2seconds) i (timer = 2seconds) m (timer = 2seconds) etc...
Hi, i am actually using wxWidgets and actually its not a string but a wxString, anyway they are similar.
For the sleep function, i just used:
sleep(1);
Here i the code :
1 2 3 4 5 6 7 8
int j = 0;
for (int i = 0 ; i < explanation.Length() ; i++)
{
// This print the substring(character by character)
m_dialog->WriteText(explanation.SubString(j,i));
j++;
sleep(1);
}
So what command will be used to activate the cursor during the sleep period?.....and who is going to be able to read all these disjointed characters over x lines?
Would you not be better off with a string like:
string s={"A m.....I.....n o t.....j u s t.....s o......s t u p i d "};
cout<<s;
Note: use spaces (" ")I.L.O. dots(.) when formating .