#I am not sure to understand the `NoEofError` in readUntilDelimiter, it means EOF has been reached ?
1 messages · Page 1 of 1 (latest)
// try to read a u8 from user input
fn readUInt() !u8 {
var stdin = std.io.getStdIn().reader();
var buff: [5]u8 = undefined;
const input = stdin.readUntilDelimiterOrEof(&buff, '\n') catch |err| {
if (err == error.StreamTooLong) while (try stdin.readByte() != '\n') {};
return err;
} orelse {
std.debug.print("\rerror: End of Input reached\n", .{});
std.process.exit(1);
};
return try std.fmt.parseUnsigned(u8, input, 10);
}
basically trying to read a u8 from stdin
NoEofError is the set of all errors that can be returned from a *NoEof function, it is not the name of any specific error