Let's consider I have a for(;;) loop, it gets a new string by every iteration, and passes it to system("espeak") like this:
for(;;)
{
string str = getNewString();
string str2 = "espeak '" +str+ "'";
system(str2.c_str());
}
But when the first str passes to espeak it starts to say it, but before it ends the speaking, for loop runs again and passes a new string and it crashes.
I am looking a way, my program pauses the for loop untill the espeak done! Is it possible? How?