J'aimerai lancer à intervalle de temps régulier une fonction basée sur un interruption d'horloge. Je voudrais savoir si c'est possible sous windows et si possible, si vous pouviez me donner une source ou un site web qui expliquerai comment faire.
Voila j'ai vu qu'en dos 16 bits on pouvait faire comme çà
Balises codes rajoutées
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 #include <stdio.h> #include <dos.h> #include <conio.h> #define INTR 0X1C /* The clock tick interrupt */ void interrupt ( *oldhandler)(); int count=0; void interrupt handler() { /* increase the global counter */ count++; /* call the old routine */ oldhandler(); } int main(void) { /* save the old interrupt vector */ oldhandler = getvect(INTR); /* install the new interrupt handler */ setvect(INTR, handler); /* loop until the counter exceeds 20 */ while (count < 20) printf("count is %d\n",count); /* reset the old interrupt handler */ setvect(INTR, oldhandler); return 0; }
Partager