TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Dan Charrois 70721,1506 (X)
from: Pete Lyall 76703,4230
date: 1990-08-20 09:17:00
subject: #6213-#popen() & pclose()

#: 6223 S3/Languages
    20-Aug-90  09:17:00
Sb: #6213-#popen() & pclose()
Fm: Pete Lyall 76703,4230
To: Dan Charrois 70721,1506 (X)

Dan -

These calls are supported in the current release of the Kreider library. They
are documented in Unix manuals (section 3.. C Functions). The docs were
initially left out by mistake (from the Kreider libs). Mark Griffith can
probably get you a copy of that page, or if he can't, bug me and I will.

You can probably get a good bit of it from usage context. Basically, it's an
fopen() call for pipes using the specified command at the other end of the
pipe:

   FILE *woof;
   ...
   woof = popen("dir e", "r");

Will fork a dir e command, connect its output via pipe for your program to
read, using the buffered stream 'woof'.

Don't forget to use a pclose(woof) when you're done with it.

Pete

P.S. Conversely, you could write to it if properly setup:

  FILE *arf;
  ...
  arf = popen("qsort", "w")
  while(not(done))
        fprintf(woof,"%s", word[count++]);

Pete

There are 2 Replies.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.