Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

smogsy

macrumors 6502a
Original poster
Jan 8, 2008
592
2
heres my Code it works correctly for what i want to do, but i want to Delay The loop for 10 seconds each time so it say Sent To IP (delay 10 second) Sent To IP (delay 10 sec) and so on...

hope you can help

#include <stdio.h>

int main()
{
int x;
/* The loop goes while x < 10, and x increases by one every loop*/

for ( x = 0; x < 16; x++ ) {

printf("Sent Code To IP" "%d\n", x );
}
getchar();
}
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
You can use the select function to pause with finer granularity, but in this case sleep should be fine. As an aside, sleep guarantees a pause for AT LEAST the time you specify, but it can be longer. It generally isn't too much longer, but you can't depend on it to return after exactly 10 seconds, etc.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.