Back to index

glibc  2.9
Functions
popen.c File Reference
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void write_data (FILE *stream)
int main (void)

Function Documentation

int main ( void  )

Definition at line 19 of file popen.c.

{
  FILE *output;

  output = popen ("more", "w");
  if (!output)
    {
      fprintf (stderr,
              "incorrect parameters or too many files.\n");
      return EXIT_FAILURE;
    }
  write_data (output);
  if (pclose (output) != 0)
    {
      fprintf (stderr,
              "Could not run more or other error.\n");
    }
  return EXIT_SUCCESS;
}

Here is the call graph for this function:

void write_data ( FILE stream)

Definition at line 5 of file popen.c.

{
  int i;
  for (i = 0; i < 100; i++)
    fprintf (stream, "%d\n", i);
  if (ferror (stream))
    {
      fprintf (stderr, "Output to stream failed.\n");
      exit (EXIT_FAILURE);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: