hi
i wrote a reply that took me about an half our or more (my english is not good). when i clicked the "submit request" button another login was requested an all i had written was lost.
therefore a short version of my post:
1. popen is not ansi c and you cannot both write and read from the pipe it creates, espesially not in solaris9 as the manual states.
2. in m.bach,The design of the UNIX operating system,ISBN:0-13-201799-7
one can find a description what one must do
3. i found to examples in the net which i do not check:
Mapping UNIX pipe descriptors to stdin and stdout in C
Simple popen2 implementation [c] [unix] [ipc] [popen] [popen2] [pipes]
4. in your program i am missing the second pipe. you correctly create one pipe and use the dup function to that the child's process stdin now is sent through the pipe. you must create another pipe for the stdout in the same manner
5. after exec the filehandles are inherited so your ftp-progrma will read from one pipe and write to the other. but everything in the program beinning with the line
sleep(1);
will never be executed by the child (but by the parent)
now i make a copy of this text befor i press the submit-button
mfg guenter