summaryrefslogtreecommitdiff
path: root/reference/C/FUNCTIONS/popen.html
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2008-01-27 11:37:44 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2008-01-27 11:37:44 +0100
commit7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch)
treeb1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/FUNCTIONS/popen.html
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/FUNCTIONS/popen.html')
-rw-r--r--reference/C/FUNCTIONS/popen.html88
1 files changed, 88 insertions, 0 deletions
diff --git a/reference/C/FUNCTIONS/popen.html b/reference/C/FUNCTIONS/popen.html
new file mode 100644
index 0000000..ac93bec
--- /dev/null
+++ b/reference/C/FUNCTIONS/popen.html
@@ -0,0 +1,88 @@
+<title>popen function</title>
+
+<head>
+<script language="JavaScript">
+</script>
+</head>
+
+<body bgcolor=#ffffcc>
+<hr>
+<center>
+<h1>popen function</h1>
+</center>
+<hr>
+<p>
+<b>popen</b> is used to read and write to a unix pipe.<p> This function is NOT
+included in 'C Programming Language' (ANSI) but can be found in 'The Standard
+C Library' book.
+
+<pre>
+Library: stdio.h
+
+Prototype: FILE *popen(const char *command, const char *type);
+
+Syntax: FILE *fp;
+ fp = popen( "ls -l", "r");
+
+Notes:
+ command - is the command to be issued.
+ type - r - read O/P from command.
+ - w - Write data as I/P to command.
+
+</pre>
+<hr>
+<h2>Examples:</h2>
+<img src=../../GRAPHICS/computer.gif></a>
+<a href=../EXAMPLES/popen.c> example program.</a><p>
+
+<hr>
+<h2>Notes:</h2>
+<ul>
+<li>popen will always execute the command from within the Bourne shell.
+<li>popen feeds the STDOUT back to your program. If you want STDERR,
+the following will do the trick.
+<pre>
+ fp=popen("ls -l 2>&1", "w");
+ AAAA
+ ||||
+</pre>
+</ul>
+<hr>
+<h2>See Also:</h2>
+<ul>
+<li><a href=fgetc.html>fgetc</a> Get a character from a file.
+<li><a href=files.html>fputc</a> Put a character into a file.<i>man pages</i>
+<li><a href=fprintf.html>fprintf</a> Put a formatted line into a file.
+<li><a href=fopen.html>fopen</a> Open a file.
+<li><a href=fclose.html>fclose</a> Close a file.
+<li><a href=pclose.html>pclose</a> Close a pipe.
+<li><a href=system.html>system</a> Open a pipe.
+</ul>
+
+
+<p>
+
+<hr>
+<p>
+<center>
+<table border=2 width="80%" bgcolor="ivory">
+<tr align=center>
+<td width="25%">
+<a href="../cref.html"> Top</a>
+</td><td width="25%">
+<a href="../master_index.html"> Master Index</a>
+</td><td width="25%">
+<a href="../SYNTAX/keywords.html"> Keywords</a>
+</td><td width="25%">
+<a href="funcref.htm"> Functions</a>
+</td>
+</tr>
+</table>
+</center>
+<p>
+<hr>
+<address>Martin Leslie
+</address><p>
+</body>
+</html>
+