Equuivalent du sleep() en visual
killaon
-
Canard007 Messages postés 5954 Date d'inscription Statut Contributeur -
Canard007 Messages postés 5954 Date d'inscription Statut Contributeur -
y a t'il un équivalent au sleep() pour le visualC(sa marche pas).je veux attendre x seconde sans rien faire.
3 réponses
-
Salut,
Doc win32The Sleep function suspends the execution of the current thread for a specified interval. VOID Sleep( DWORD dwMilliseconds // sleep time in milliseconds ); Parameters dwMilliseconds Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay. Return Values This function does not return a value. Remarks A thread can relinquish the remainder of its time slice by calling this function with a sleep time of zero milliseconds. You have to be careful when using Sleep and DDE. If a thread creates any windows, it must process messages. DDE sends messages to all windows in the system. If you have a thread that uses a wait function with no time-out interval, the system will deadlock. Therefore, if you have a thread that creates windows, use MsgWaitForMultipleObjects or MsgWaitForMultipleObjectsEx, rather than Sleep.
Donc Sleep sa marche (avec un S majuscule attention) suffit d apeller
windows.h
pour attendre x secondes suffit de faire x fois 1000 pour l avoir en milliseconde..
et voila le code test qui marche ..
#include <windows.h> #include <stdio.h> void main( ) { printf("debut\n"); Sleep(10000); //s affiche au bout de 10 secondes printf("fin\n"); } -
-
lol
ba oui fo aller au fond des choses...;p