mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-24 19:51:11 +00:00
34 lines
527 B
C
34 lines
527 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
void
|
|
write_data (FILE * stream)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
|
|
/*@group*/
|
|
int
|
|
main (void)
|
|
{
|
|
FILE *output;
|
|
|
|
output = popen ("more", "w");
|
|
if (!output)
|
|
{
|
|
fprintf (stderr, "Could not run more.\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
write_data (output);
|
|
pclose (output);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
/*@end group*/
|