how to set delay in a Loop

Discussion in 'Mac Programming' started by smogsy, Oct 8, 2008.

  1. smogsy macrumors 6502a

    Joined:
    Jan 8, 2008
    #1
    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

     
  2. mufflon macrumors 6502

    Joined:
    Sep 15, 2006
    #2
    I would advice on using sleep(10000) (e.g. milliseconds), it works in java and it seems to be implemented for c as well

    a page which implies that it exists

    Alternatively google for "C sleep"

    edit: might be seconds, checkout

    here instead
     
  3. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    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
     

Share This Page