From owner-freebsd-questions Thu Jan 18 7:32: 3 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail.astercity.net (smtp.astercity.net [212.76.33.36]) by hub.freebsd.org (Postfix) with ESMTP id DEC0A37B400 for ; Thu, 18 Jan 2001 07:31:42 -0800 (PST) Received: from BS.home.astercity.net (unknown [10.13.13.3]) by mail.astercity.net (SECureMail) with ESMTP id 94EC27D517 for ; Thu, 18 Jan 2001 16:31:31 +0100 (CET) Date: Thu, 18 Jan 2001 16:31:26 +0100 (CET) From: Michal Zapasnik X-Sender: bigstar@BS.home.astercity.net To: freebsd-questions@freebsd.org Subject: System functions in BSD and others *nix systems. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all I was writeing simple program for school using system funcions msgget, msgsnd and msgrcv. This program run fine on other OS i tested it on debian,RedHat and SunOS on my FreeBSD box the resaults are bad. Are the system funcion different in FBSD? This is my simple program --- queue.h --- #define ONE ftok("/home/bigstar/one.c" , '0') struct data { int mtype; int mtext; }; --- one.c --- #include #include #include #include #include #include "queue.h" int main() { int q, i; struct data msg; q=msgget(ONE,IPC_CREAT|0660); msg.mtype = 1; msg.mtext = 5; for (i=0; i<10; i++) { msgsnd(q, &msg, sizeof(msg), 0); sleep(1); } } --- two.c --- #include #include #include #include #include #include "queue.h" int main() { int q, i; struct data msg; q=msgget(ONE,IPC_CREAT|0666); for (i=0; i<10; i++) { msgrcv(q, &msg, sizeof(msg), 0, 0); printf("I recive: %d \n", msg.mtext); } } When i run ./one | ./two on FreeBSD i get I recive: 671473920 and sa on as i wrote on other tested OS it works fine. Anyone know where the problem is? BS. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message