C言語から、他のアプリケーションを実行します。
UNIXの場合は、実行モードが必要。
pipeストリームのオープン処理。
#include <stdio.h>
FILE *popen(const char *command, const char *mode);
#include <stdio.h> main(){ FILE *fp = NULL; char file[128]; /* オープン */ fp = popen ("ls -1", "r"); while (!feof(fp)) { memset (file, 0x00, sizeof(file)); /* 読み込み */ fscanf (fp, "%s", file); printf ("%s\n", file); } /* クローズ */ pclose (fp); }