Files
RedBear-OS/tests/stdio/popen.c
T
2019-02-24 00:46:26 +01:00

18 lines
341 B
C

#include <stdio.h>
#include <stdlib.h>
#include "test_helpers.h"
int main(void) {
FILE *fp = popen("ls -1 example_dir", "r");
ERROR_IF(popen, fp, == NULL);
char path[256] = { 0 };
while (fgets(path, 256, fp) != NULL) {
printf("%s", path);
}
int status = pclose(fp);
ERROR_IF(pclose, status, == -1);
}