hello-world #25
Replies: 4 comments 3 replies
-
Hello, world! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
有文章可以了解 为什么设计成 const std = @import("std"); 这种导入包的方式吗? 而不是 import .. as .. |
Beta Was this translation helpful? Give feedback.
2 replies
-
没有讲标准输入,给初学者参考哦,其他读取函数在zig 安装目录 lib\std\io.zig文件内,可以看看 var array: [10]u8 = undefined;
const stdout = @import("std").io.getStdOut().writer();
const stdin = @import("std").io.getStdIn().reader();
try stdout.print("Enter a world: ", .{});
const slice: []u8 = array[0..((try stdin.read(&array)) - 2)]; //输入超过8个出问题,哈哈
try stdout.print("{s}\n", .{slice}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello-world
简单、快速地学习 Zig,ziglang中文教程,zig中文教程
https://course.ziglang.cc/hello-world.html
Beta Was this translation helpful? Give feedback.
All reactions