You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 656c792
Browse filesBrowse the repository at this point in the historyBrowse files
Currently we translate `FILE*` as `*mut std::fs:FILE`. This makes it
difficult to translate functions such as feof and ferrror.
feof and ferror both peek the internal state of the FILE object.
std::fs::File doet not keep an internal state, it propagates the error
right at the point of the usage, for example when performing a read or a
write. On the other side, `*mut libc::FILE`, which is the direct FFI
equivalent of `FILE*`, keeps the internal state, making the translation
of feof and ferror easy.
Another advantage of switching to `*mut libc::FILE` is that it
simplifies all stdio.h rules. For example fwrites becomes a simple call
to `libc::fwrite`, instead of the hand-rolled implementation that we
have now for writing a buffer into `std::fs::File`.
0 commit comments