g++ wait command

I have wrote a while loop that reads one line at a time and sends an email to the user. I was using strcpy & strcat to move in to memory and then system(buffer) to run it. Locked up the server because it was too much all at once. I have been tring to figure out how to put a wait(seconds) command between each while loop.

I tried
wait(2);
pause(2);

What am I over looking.

Thanks in advance.
Bob Ross
bross073097Asked:
Who is Participating?
 
jakedConnect With a Mentor Commented:
You want sleep(seconds). wait() waits for a child process to die, and pause() pauses until a signal is received.

0
 
bross073097Author Commented:
Thanks, I was at wit's end with this.

Bob

0
 
bross073097Author Commented:
I tried sleep(10);

When I compiled it g++ test.c I received

implicit declaration of function 'int sleep(...)'

What did I miss.

Thanks
Bob Ross
0
 
bross073097Author Commented:
I got it, I forgot to put the unistd.h #include

Thanks

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.