/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that prints the result of command "ls". */
#include <stdlib.h>
#include <stdio.h>

int main() {
    FILE *fstream;
    char ch;
    
    fstream = popen("ls","r"); /* returns a stream pointer that can read
				  from the standard output of the command */
    while((ch = fgetc(fstream)) != EOF) {
      printf("%c",ch);
    }
    pclose(fstream);
}
