00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include <stdio.h>
00020 #include <fcntl.h>
00021 #include <unistd.h>
00022 #include <stdlib.h>
00023 #include <errno.h>
00024 
00029 char PressKey()
00030         {
00031         char ch;
00032         fflush(stdout);
00033         ch=getchar();
00034         return ch;
00035         }
00036 
00042 int Error(char msg[])
00043         {
00044         printf("%s [Error NUMBER = %d]\n",msg,errno);
00045         PressKey();
00046         return EXIT_FAILURE;
00047         }
00048 
00049 int main()
00050 {
00052         char fifoFileName[] = "myfifofile";
00055         int fifoFd = open(fifoFileName,O_WRONLY);
00057         if(fifoFd == -1)
00058         {
00060                 Error("\n*** child failure FIFO Open ***\n");
00061                 return EXIT_FAILURE;
00062         }
00063         else
00064         {
00066                 char TxMsg[] = "Hello Parent [FIFO]\n";
00068                 write(fifoFd,TxMsg,sizeof(TxMsg));
00070                 (void)close(fifoFd);
00071         }
00072         return EXIT_SUCCESS;
00073 }
00074