回答編集履歴
1
加筆
test
CHANGED
@@ -3,3 +3,39 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
ひょっとしてやりたいことは popen か?
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
Windowsだとこんな↓感じ。
|
12
|
+
|
13
|
+
```C
|
14
|
+
|
15
|
+
#include <stdio.h>
|
16
|
+
|
17
|
+
#include <stdlib.h>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
int main() {
|
24
|
+
|
25
|
+
char line[256];
|
26
|
+
|
27
|
+
FILE* fp = _popen("dir /B", "r");
|
28
|
+
|
29
|
+
while ( fgets(line, 256, fp) ) {
|
30
|
+
|
31
|
+
printf("%s", line);
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
_pclose(fp);
|
36
|
+
|
37
|
+
return 0;
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
```
|