mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 08:33:15 +00:00
* Merge io.InStream and io.OutStream into io.File
* Introduce io.OutStream and io.InStream interfaces
- io.File implements both of these
* Move mem.IncrementingAllocator to heap.IncrementingAllocator
Instead of:
```
%return std.io.stderr.printf("hello\n");
```
now do:
```
std.debug.warn("hello\n");
```
To print to stdout, see `io.getStdOut()`.
* Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
11 lines
369 B
Zig
11 lines
369 B
Zig
const std = @import("std");
|
|
|
|
pub fn main() -> %void {
|
|
// If this program is run without stdout attached, exit with an error.
|
|
var stdout_file = %return std.io.getStdOut();
|
|
const stdout = &stdout_file.out_stream;
|
|
// If this program encounters pipe failure when printing to stdout, exit
|
|
// with an error.
|
|
%return stdout.print("Hello, world!\n");
|
|
}
|