00001 // fifochild.c 00002 // 00003 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 00004 // All rights reserved. 00005 // This component and the accompanying materials are made available 00006 // under the terms of "Eclipse Public License v1.0" 00007 // which accompanies this distribution, and is available 00008 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00009 // 00010 // Initial Contributors: 00011 // Nokia Corporation - initial contribution. 00012 // 00013 // Contributors: 00014 // 00015 // Description: 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
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.