| To: | yyyyyyyyyyyyyyy@xxxxxxxxxxxxx |
|---|---|
| Subject: | Bug in TC2-d2 popen() |
| From: | yyyyyyyyy@xxxxxxx |
| Date: | Fri, 18 Jul 2003 15:18:38 +0100 (BST) |
Bug report from : Michael Kerrisk , self
(Note that the reply-to line automatically redirects
to yyyyyyyyyyyyyy@xxxxxxxxxxxxx for further discussion on bug reports)
@ page 1 line 28077 section popen() comment {example for popen()}
Problem:
This is an EXAMPLE for the popen() man page. Line number
references are to TC1. A pointer could also be added
to this example on the pclose() page (line 27732).
Action:
Change
"None"
to the following:
The following example demonstrates the use of popen()
and pclose() to execute the command "ls *" in order to
obtain a list of files in the current directory:
FILE *fp;
int status;
char path[PATH_MAX];
fp = popen("ls *", "r");
if (fp == NULL)
/* Handle error */;
while (fgets(path, PATH_MAX, fp) != NULL)
printf("%s", path);
status = pclose(fp);
if (status == -1) {
/* Error during execution of popen() */
} else {
/* Use macros described under wait() to inspect 'status' in order
to determine success/failure of command executed by popen() */
}
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Bug in TC2-d2 pipe(), mtk-lists |
|---|---|
| Next by Date: | Bug in TC2-d2 sigaction(), mtk-lists |
| Previous by Thread: | Bug in TC2-d2 pipe(), mtk-lists |
| Next by Thread: | Bug in TC2-d2 sigaction(), mtk-lists |
| Indexes: | [Date] [Thread] [All Lists] |