#include #include #include #include #include #include #include "zone.h" #include #include float randomF() { return ((float)100.0*(rand()/(RAND_MAX+0.1))); } int main() { int i; zone maZoneMemoire; key_t clef; int msqid; clef = ftok("/tmp/bidon", 5678); msqid = msgget(clef, 0666 | IPC_CREAT); if(msqid == -1) { printf("Erreur creation file message : %s\n", strerror(errno)); } while(1) { maZoneMemoire.type = randomF(); msgsnd(msqid, (struct msgbuf *) &maZoneMemoire, sizeof(maZoneMemoire), 0); printf("Nouveau message envoye.\n"); usleep(99999); } }