File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,17 @@ namespace std {
1111
1212## 概要
1313
14- ホスト環境のコマンド呼び出す 。(e.g. `/bin/sh`, `cmd.exe`)
14+ ホスト環境のコマンドを呼び出す 。(e.g. `/bin/sh`, `cmd.exe`)
1515
16- 基本の返り値はコマンドの実行結果 。
16+ 処理系定義の値を返す。大抵は呼び出されたコマンドが返した終了ステータスになる 。
1717
18- コマンドがヌルポインタの場合、ホスト環境にコマンドプロセッサが存在するか確認し、存在している場合のみに非ゼロ値を返す 。
18+ コマンドがヌルポインタの場合、ホスト環境にコマンドプロセッサが存在するか確認し、存在している場合に非ゼロ値を返す 。
1919
2020## 備考
2121
22- POSIXでは`WEXITSTATUS`と`WSTOPSIG`を使用、分解できる
22+ POSIXではマクロ`WEXITSTATUS`と`WSTOPSIG`を使用して戻り値を分解できる。
23+ `WEXITSTATUS(戻り値)` は子プロセスが正常に終了した場合に非ゼロ値を返す。
24+ `WSTOPSIG(戻り値)` は子プロセスを停止したシグナル番号を評価する。
2325
2426生成されるプロセスが画面の入出力を伴う場合、`std::system`を呼び出す前に、`std::cout`の明示的なフラッシュが必要になる場合がある。
2527
@@ -32,12 +34,12 @@ POSIXでは`WEXITSTATUS`と`WSTOPSIG`を使用、分解できる
3234
3335int main()
3436{
35- std::system("ls -l >test.txt");// "ls -l >test.txt"を実行
37+ std::system("ls -l >test.txt"); // "ls -l >test.txt"を実行
3638 std::cout << std::ifstream("test.txt").rdbuf();
3739}
3840```
3941
40- ## 出力結果
42+ ## 出力例
4143
4244```
4345total 16
@@ -48,8 +50,6 @@ total 16
4850
4951## 関連項目
5052
51- | 名前 | 説明 |
52- | ------| ------|
53- | [ ` flush ` ] ( ../ostream/flush.md ) | バッファをフラッシュする|
54- | [ ` WEXITSTATUS ` ] ( ) | 子プロセスが正常に終了した場合、非ゼロ値を返す |
55- | [ ` WSTOPSIG ` ] ( ) | 子プロセスを停止したシグナル数を評価する |
53+ | 名前 | 説明 |
54+ | --------------------------------| --------------------------------------------------------|
55+ | [ ` flush ` ] ( ../ostream/flush.md ) | バッファをフラッシュする |
You can’t perform that action at this time.
0 commit comments