| | |
Pipe in Unix
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 69
Reputation:
Solved Threads: 0
I am doing fork(), I need to send messages between parent & child..
am using this..
char readbuffer[80];
int fd[2], nbytes;
if(child == 0)
{
close(fd[0]);
nbytes = read(fd[0], readbuffer, sizeof(readbuffer);
index = atoi(readbuffer);
}
else{
close(fd[1]);
sprintf(sending, "%i", index);
write(fd[1], sending, strlen(sending)+1);
}
Index is an integer am sending to the child...its not working.anyone know why???
am using this..
char readbuffer[80];
int fd[2], nbytes;
if(child == 0)
{
close(fd[0]);
nbytes = read(fd[0], readbuffer, sizeof(readbuffer);
index = atoi(readbuffer);
}
else{
close(fd[1]);
sprintf(sending, "%i", index);
write(fd[1], sending, strlen(sending)+1);
}
Index is an integer am sending to the child...its not working.anyone know why???
![]() |
Similar Threads
- Issues emailing data from unix/sql script (Shell Scripting)
- How to padd the words in unix script.... Help required (Shell Scripting)
- Returing Value from C++ code to unix shell script (C++)
- Unix, C++, pipe and fork (C++)
- I need help (Viruses, Spyware and other Nasties)
- Listing files in a folder (C++)
- file unable to open (C++)
Other Threads in the C Forum
- Previous Thread: Error while running make of mod_wsgi
- Next Thread: warning: assignment makes pointer from integer without a cast
Views: 789 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C
#include ansi array arrays asterisks binarysearch calculate centimeter changingto char command convert copyimagefile cprogramme creafecopyofanytypeoffileinc database directory dynamic fflush file fork forloop framework functions getlasterror givemetehcodez grade graphics gtkgcurlcompiling hacking hardware histogram homework inches include incrementoperators input iso kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives looping loopinsideloop. lowest match matrix microsoft motherboard mysql number opendocumentformat opensource owf pattern pdf performance pointer posix problem probleminc process program programming radix recursion recv research reversing scanf scripting segmentationfault sequential shape socket socketprograming spoonfeeding standard string strings structures student systemcall testing threads turboc unix user variable voidmain() wab windows.h windowsapi





