P
Patrice Kadionik
Hi all,
I want to make a brief comparison between read() and fread() (under a
Linux OS).
1. Family read and Co: open, close, read, write, ioctl...
2. Family fread and Co: fopen, fclose, fread, swrite, fcntl...
Family read and Co:
- are syscalls.
- are not formatted IO : we have a non formatted byte stream.
- don't use the Linux buffer cache.
- generally used for accessing character devices.
Family fread and Co:
- are functions of the standard IO libc (glibc).
- use an internal buffer (in their coding)
- are formatted IO (with the "%.." parameter) for some of them.
- use always the Linux buffer cache.
- generally used for accessing bloc devices.
When I'm opening an ordinary file on a HD (bloc device), I'm always
using the buffer cache with open or fopen. In case of fopen, I'm using
in addition an internal buffer when I'm doing a fread or fwrite for
speeding HD access.
When I'm opening an character device, I'm not using the buffer cache.
Open and Co are generally used here.
Is is OK?
Some points I've forgotten?
Thank you for your response;
Pat.
I want to make a brief comparison between read() and fread() (under a
Linux OS).
1. Family read and Co: open, close, read, write, ioctl...
2. Family fread and Co: fopen, fclose, fread, swrite, fcntl...
Family read and Co:
- are syscalls.
- are not formatted IO : we have a non formatted byte stream.
- don't use the Linux buffer cache.
- generally used for accessing character devices.
Family fread and Co:
- are functions of the standard IO libc (glibc).
- use an internal buffer (in their coding)
- are formatted IO (with the "%.." parameter) for some of them.
- use always the Linux buffer cache.
- generally used for accessing bloc devices.
When I'm opening an ordinary file on a HD (bloc device), I'm always
using the buffer cache with open or fopen. In case of fopen, I'm using
in addition an internal buffer when I'm doing a fread or fwrite for
speeding HD access.
When I'm opening an character device, I'm not using the buffer cache.
Open and Co are generally used here.
Is is OK?
Some points I've forgotten?
Thank you for your response;
Pat.