Skip to content

Commit 09de4c4

Browse files
committed
fix cstdlib/system.md
1 parent c2781ec commit 09de4c4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

reference/cstdlib/system.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,20 @@
55
```cpp
66
int system( const char* command );
77
```
8-
## 概要
9-
10-
11-
ホスト環境のコマンド呼び出す。(e.g. /bin/sh, cmd.exe)
128
9+
## 概要
1310
14-
Returns an implementation-defined value (usually the value that the invoked program returns).
11+
ホスト環境のコマンド呼び出す。(e.g. `/bin/sh`, `cmd.exe`)
1512
16-
If command is a null pointer, checks if the host environment has a command processor and returns a nonzero value if and only if the command processor exists.
13+
基本の返り値はコマンドの実行結果。
1714
18-
Parameters
19-
command - character string identifying the command to be run in the command processor. If a null pointer is given, command processor is checked for existence
20-
Return value
21-
Implementation-defined value. If command is a null pointer, returns a nonzero value if and only if the command processor exists.
15+
コマンドがヌルポインタの場合、ホスト環境にコマンドプロセッサが存在するか確認し、存在している場合のみに非ゼロ値を返す。
2216
23-
Notes
24-
On POSIX systems, the return value can be decomposed using WEXITSTATUS and WSTOPSIG.
17+
## 注釈
2518
26-
The related POSIX function popen makes the output generated by command available to the caller.
19+
POSIXでは`WEXITSTATUS`と`WSTOPSIG`を使用、分解できる
2720
28-
An explicit flush of std::cout is also necessary before a call to std::system, if the spawned process performs any screen I/O.
21+
生成されるプロセスが画面の入出力を伴う場合、`std::system`を呼び出す前に、`std::cout`の明示的なフラッシュが必要になる場合がある。
2922
3023
## 例
3124
@@ -36,7 +29,7 @@ An explicit flush of std::cout is also necessary before a call to std::system, i
3629
3730
int main()
3831
{
39-
std::system("ls -l");
32+
std::system("ls -l >test.txt");//"ls -l >test.txt"を実行
4033
std::cout << std::ifstream("test.txt").rdbuf();
4134
}
4235
```
@@ -50,3 +43,10 @@ total 16
5043
-rw-r--r-- 1 2001 2000 0 Sep 30 20:52 test.txt
5144
```
5245

46+
## 関連項目
47+
48+
| 名前 | 説明 |
49+
|------|------|
50+
|[`flush`](../ostream/flush.md)|バッファをフラッシュする|
51+
| [`WEXITSTATUS`]() | 子プロセスが正常に終了した場合、非ゼロ値を返す |
52+
| [`WSTOPSIG`]() | 子プロセスを停止したシグナル数を評価する |

0 commit comments

Comments
 (0)