first commit
This commit is contained in:
commit
9b51842ca5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
material
|
19
src/main.zig
Normal file
19
src/main.zig
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
const read = @import("./qtshit/read.zig");
|
||||||
|
const write = @import("./qtshit/write.zig");
|
||||||
|
|
||||||
|
|
||||||
|
pub fn main() !void {
|
||||||
|
const stdout = std.io.getStdOut().writer();
|
||||||
|
try stdout.print("Hello, {s}!\n", .{"world"});
|
||||||
|
|
||||||
|
var byteList = std.ArrayList(u8).init(std.heap.page_allocator);
|
||||||
|
defer byteList.deinit();
|
||||||
|
|
||||||
|
try write.add_int(byteList.writer(), 4242);
|
||||||
|
|
||||||
|
var reader = std.io.fixedBufferStream(byteList.items).reader();
|
||||||
|
try stdout.print("Number: {} \n", .{try read.get_int(reader)});
|
||||||
|
|
||||||
|
}
|
3
src/qtshit/read.zig
Normal file
3
src/qtshit/read.zig
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub fn get_int(reader: anytype) !u16 {
|
||||||
|
return try reader.readIntBig(u16);
|
||||||
|
}
|
6
src/qtshit/write.zig
Normal file
6
src/qtshit/write.zig
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
|
||||||
|
pub fn add_int(writer: anytype, number: u16) !void {
|
||||||
|
try writer.writeIntBig(u32, 10);
|
||||||
|
}
|
Loading…
Reference in a new issue