Skip to content

Commit

Permalink
print(ln) : 出力先を指定する例、モジュールインポートの例を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
faithandbrave committed Feb 1, 2023
1 parent c10f83d commit 88c0244
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
25 changes: 24 additions & 1 deletion reference/print/print.md
Expand Up @@ -84,19 +84,42 @@ namespace std {


##
### 基本的な使い方
```cpp example
#include <print>

int main()
{
std::print("Hello {} World\n", 42);

// 出力先を指定
std::print(stdout, "Hello {} World\n", 42); // 標準出力に出力
std::print(stderr, "Hello {} World\n", 42); // 標準エラーに出力
}
```
* std::print[color ff0000]

### 出力
#### 出力
```
Hello 42 World
Hello 42 World
Hello 42 World
```

### モジュールをインポートする例
```cpp example
#import std;
#import std.compat;

int main()
{
std::print("Hello {} World\n", 42); // OK

// stdout / stderrはマクロとして定義される。
// モジュールはマクロをエクスポートしないので、
// stdout / stderrは使用できない
std::print(stdout, "Hello {} World\n", 42); // エラー!stdoutが見つからない
}
```

## バージョン
Expand Down
25 changes: 24 additions & 1 deletion reference/print/println.md
Expand Up @@ -52,19 +52,42 @@ namespace std {


##
### 基本的な使い方
```cpp example
#include <print>

int main()
{
std::println("Hello {} World", 42);

// 出力先を指定
std::println(stdout, "Hello {} World", 42); // 標準出力に出力
std::println(stderr, "Hello {} World", 42); // 標準エラーに出力
}
```
* std::println[color ff0000]

### 出力
#### 出力
```
Hello 42 World
Hello 42 World
Hello 42 World
```

### モジュールをインポートする例
```cpp example
import std;
import std.compat;

int main()
{
std::println("Hello {} World", 42); // OK

// stdout / stderrはマクロとして定義される。
// モジュールはマクロをエクスポートしないので、
// stdout / stderrは使用できない
std::println(stdout, "Hello {} World", 42); // エラー!stdoutが見つからない
}
```

## バージョン
Expand Down

0 comments on commit 88c0244

Please sign in to comment.