signal() : passer un parametre a la fonction appellée
Bonjour,
dans mon programme, j'aimerais "catcher" le signal SIGINT.
Pour tester, j'ai fait ce petit bout de code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <stdio.h>
#include <signal.h>
bool toto=false;
void fonction(int n)
{
toto=true;
printf("Signal recu\n");
}
int main()
{
signal(SIGINT,fonction);
while(!toto) {
usleep(1);
}
return(0);
} |
Ma question est :
Comment puis je envoyer un int en parametre à la fonction "fonction" ?
Merci d'avance.