| | |
Pipe in Unix
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 60
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
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks binarysearch calculate changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fflush fgets file fork forloop framework function getlasterror givemetehcodez grade gtkwinlinux hacking hardware histogram inches include incrementoperators input intmain() iso kernel keyboard km license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opendocumentformat opensource overwrite owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming standard string systemcall testing threads turboc unix user variable voidmain() wab whythiscodecausesegmentationfault windowsapi





