-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libc: implement fread()
#66940
Comments
@RAJAGOPALAN-GANGADHARAN - done! However, something to keep in mind is that https://en.cppreference.com/w/c/io/fread Additionally, a fairly fundamental problem needs to be solved for this to be done The Right Way (TM). Namely, we need a way to easily associate That would ideally be done in ZVFS (which is itself a kind of relocation of code from various libraries and subsystems to avoid dependency cycles at the API level. |
Thanks @cfriedt - Looking at how fwrite has been implemented in minimal libc currently, seems like it only supports write to stdout and stderr. No fs support seems to be added (the use of zephyr fs apis like fs_open etc - https://docs.zephyrproject.org/latest/services/file_system/index.html#c.fs_dir_t.), is this what is expected from the fread (read from stdin) as well? Also in the future will the support be expanded to fs operations for these apis? Thanks! |
@RAJAGOPALAN-GANGADHARAN Currently stdin / stdout / stderr should work, but we do want to support operations on other files as well. |
@cfriedt Is correct. C standard is subset of POSIX standard (or POSIX standard is superset over C). Look also at the C standard, draft, here https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf - you will notice that the fread is part of stdlib definition (Chapter 7). |
This was originally added as a ticket under POSIX, but
fread()
is not a POSIX function. It is from C89.https://en.cppreference.com/w/c/io/fread
The expectation from the POSIX API is that this function is implemented as part of whatever C library is in use.
The text was updated successfully, but these errors were encountered: