int fd; char sfd; char *ch; ch = (char*)malloc(sizeof(char)*40); if(!ch) { perror("malloc"); exit(EXIT_FAILURE); } printf("Enter some string to write in file\n"); fgets(ch,30,stdin); printf("%s:Begin :File %d:pid\n",__FILE__,getpid()); fd = open("myfile",O_RDWR); write(fd,ch,30); sprintf(&sfd,"%d",fd); execl("./hii","hii.c",&sfd,NULL); printf("%s:End %d:pid\n",__FILE__,getpid()); } ~ Here i am able to open the file and write some data and pass this file descriptor to another proceess where i am using to read this file The Question is i am able to receive this file descriptor and file is also able to open for read but when i am printing the character the other process is not printing the charachters or data
code for other process is =====================================
int main(int argc ,char *argv[]) { int fd,i; char c; printf("%s:Begin :File %d:pid\n",__FILE__,getpid()); fd = atoi(argv[1]); printf("Hello!!!Never lose your Hope,Tomorrow will be a new Sunshine :) \n"); printf("%s:argv[0]\n",argv[0]); printf("%s:argv[1]\n",argv[1]); printf("%s:argv[2]\n",argv[2]); if(read(fd,&c,1)==-1) { perror("read"); exit(EXIT_FAILURE); }
printf("%d:fd\n",fd); printf(" %c:c\n",c);
======================================================= Any suggestion ~ ~
Now i got stuck in read the output of processing client to the request client through server. Current scenario : Client is able to send the request to server and server sends that request to processing client here processing client perform the operation on write it then this result is also read in server and then i write the same data to request client but Here request client is performing only write opration after that it going block no further proceed how i can read and write the data in requesting client
RCS file: createPipes.c,v Working file: createPipes.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: Here Pipes are created and allocate the memory for each pipe. ---------------------------- revision 1.1 locked by: root; date: 2017/12/02 18:56:33; author: root; state: Exp; Initial revision =============================================================================
RCS file: init.c,v Working file: init.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: this is initialization function where all function pointer defination is insilized here ---------------------------- revision 1.1 locked by: root; date: 2017/12/02 18:57:06; author: root; state: Exp; Initial revision =============================================================================
RCS file: multi.c,v Working file: multi.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: this is the processing client for operation multiplication ---------------------------- revision 1.1 locked by: root; date: 2017/12/02 19:33:48; author: root; state: Exp; Initial revision =============================================================================
RCS file: rc1.c,v Working file: rc1.c head: 1.3 branch: locks: strict root: 1.3 access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: RC1 is the requesting client which is responsible for the data request and the write the data after operation by processing client through server ---------------------------- revision 1.3 locked by: root; date: 2017/12/03 23:46:21; author: root; state: Exp; lines: +1 -1 read the result ---------------------------- revision 1.2 date: 2017/12/03 16:22:02; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.1 date: 2017/12/02 18:57:54; author: root; state: Exp; Initial revision =============================================================================
RCS file: rc2.c,v Working file: rc2.c head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: RC1 is the requesting client which is responsible for the data request and the write the data after operation by processing client through server for subtraction ---------------------------- revision 1.1 locked by: root; date: 2017/12/02 19:12:13; author: root; state: Exp; Initial revision =============================================================================
RCS file: rc3.c,v Working file: rc3.c head: 1.2 branch: locks: strict root: 1.2 access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: RC1 is the requesting client which is responsible for the data request and the write the data after operation by processing client through serverfor multiplication ---------------------------- revision 1.2 locked by: root; date: 2017/12/03 16:22:14; author: root; state: Exp; lines: +1 -1 *** empty log message *** ---------------------------- revision 1.1 date: 2017/12/02 19:13:26; author: root; state: Exp; Initial revision