![]() |
|
|
|
|
|||||||
| 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 |
| Python: popen problems | sendai | Shell Programming and Scripting | 2 | 06-11-2007 06:05 PM |
| help needed with sort. pipe and popen() | the_learner | UNIX for Dummies Questions & Answers | 7 | 05-21-2007 04:24 PM |
| using popen with background process | matrixmadhan | High Level Programming | 7 | 08-22-2006 03:02 AM |
| popen and tar, please HELP! | stef83 | High Level Programming | 4 | 05-25-2005 07:41 AM |
| query in popen | collins | High Level Programming | 1 | 11-07-2004 06:42 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
question about popen();
Hi
The following is my program to test popen() routine. The purpose is to print some contents of the corrent directory. But in fact, the output is only one character 'a', which I believe is the first char of the file "a.out". So, can anybody tell me what is wrong about this program? Thanks. #include <stdio.h> main() { FILE* pipe; int i; char ch; pipe=popen("ls","r"); for (i=0;i<=15;i++); { ch= fgetc(pipe); printf("%c\n",ch); } } |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Your "for" loop isn't connected to your "for" statement. Drop that last semicolon on the same as your "for" statement.
|
|
#3
|
|||
|
|||
|
thanks
thank you
|
|||
| Google The UNIX and Linux Forums |