I\'m reading source code of the linux tool badblocks. They use the read() function there. Is there a difference to the standard C fread() function?
One difference you should be aware of if you are converting code that uses one to using the other:
fread blocks until the number of bytes you asked for has been read, or the file ends, or an error occurs.read also blocks, but if you ask for say 4kB it may return after reading just 1kB, even if the file has not ended.This can cause subtle bugs, as it depends on where the file is stored, caches, etc.