I'm somewhat new to C. I am wondering, is the
read(2)
read
ssize_t
ssize_t
This POSIX function is deprecated. Use the ISO C++ conformant _read instead.
fread
fread(buf, 1, sizeof(buf), stdin)
read(STDIN_FILENO, buf, sizeof(buf))
read
read()
is not and never has been standard C, so if you want to write portable code which reads from files, don't use it; use fread()
.
On the other hand, there may be things you want to do on a Posix system which are not portable, such as use pipes and sockets. In that case, go ahead and use the Posix interfaces.