functionMain(); is not executing every 5 seconds, don't know whyCode:int main()
{
function1();
function2();
function3();
do{
functionMain();
Sleep(5000);
}
while (1 == 1);
}
Please help
Printable View
functionMain(); is not executing every 5 seconds, don't know whyCode:int main()
{
function1();
function2();
function3();
do{
functionMain();
Sleep(5000);
}
while (1 == 1);
}
Please help
Does it get executed only once? What happens after that? Does the application exit? May be there is some code to exit the app inside functionMain? Just check.
every function is executed except functionMain();
no error, just the function is not executed
i want to execute functionMain() every 5 seconds
I do not see anything wrong with the code. I tried on my machine and FunctionMain should be called. How did you verify that it is not called?
On a side note, while(true) is the common paradigm for putting an infinite loop.
Hello,
Problem lies not in the code you have shown but somewhere else, I feel. The code modified from what you have shown
prints the complaint I am stuck in an infinite loop every 5 seconds till I close the program manually.Code:do
{
cout << "I am stuck in an infinite loop" << endl;
Sleep(5000);
}
while (1 == 1);
Just being curious: Why did you design it as an infinite loop?
Regards,
Pravin.
You must give some initial value to i. Do not think that it will be zero by default. If you do not initialize it, then it will have some garbage value.
Instead of just writing
int i;
write
int i = 0;
I posted "Initialize i" in response to a post of yours. Now I do not see that post. Did you delete it?