![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to write to stdin of another program (program A -> [stdin]program B) | vvaidyan | UNIX for Dummies Questions & Answers | 3 | 08-02-2008 02:21 PM |
| Perform action file name written to the pipe | fed.linuxgossip | Shell Programming and Scripting | 2 | 07-23-2008 07:38 AM |
| C++ How to use pipe() & fork() with stdin and stdout to another program | vvaidyan | High Level Programming | 2 | 05-16-2008 04:30 PM |
| How to write to stdin of another program (program A -> [stdin]program B) | vvaidyan | High Level Programming | 1 | 04-30-2008 10:44 AM |
| AIX 5.3 - There is no process to read data written to a pipe | vigsgb | UNIX for Advanced & Expert Users | 4 | 06-21-2006 01:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
to clear out the left overs in STDIN....,
fflush(STDIN); this should work. correct me if it is no the one which you are looking for...!! -ilan |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
fflush is undefined for reading. If this happens to work, that is great, but you cannot depend on programming by coincidence... Per C standard.
You have to read an input stream or socket to clear it. |
|
#10
|
|||
|
|||
|
problem solved
There is high potential for me to get beaten up in this forum for what silly mistake i did, which was causing all the problem. But I know several people have looked in through this thread spending significant time in providing me the solution, and this is something I do not take it for granted.
This is what was causing the problem: int StartPipe(iosockinet &s, char input_to_program_b[]) { int fd1[2]; int fd2[2]; pid_t pid; char line[MAXLINE]; I did not initialise the above char array to null; char line[MAXLINE] = {0}; solved the problem. Thank you so much guys, I learnt a lot from the information you guys provided me with. Vivek |
|
#11
|
|||
|
|||
|
Hi Jim,
just started with looking at threads to get started with programming C :-) now, after reading further on your comment i got to the problems that fflush can do...(ofcourse any functions that have unexpected anomalies) Thanks!! -ilan |
|||
| Google The UNIX and Linux Forums |