Ziggit

`std.Io.Reader.takeByte` behavior compared to `std.c.read` (opens in new tab)

Hi guys! I’ve been getting my hands dirty on the new Io reader and I think I need some help understanding the behavior of the takeByte function. Long story short, I’m trying to read from stdin byte by byte using the takeByte function, and it unexpectedly throws EndOfStream. but if I were to use either std.posix.read or std.c.read the code works like I expected it too, am I missing something important here? while (true) // this works var buf: [1]u8 = undefined; _ = c_api.read(c_api.STDIN_FILEN...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help