Interview answers verified by specialists.

Find interview questions and answers on this website:

See right interview answers on 30 common job interview questions

How do you determine whether to use a stream function or a low-level function?

Stream functions such as fread() and  fwrite() are buffered and are more efficient when reading and writing
text or binary data to files. You generally gain better performance by using stream functions rather than their
unbuffered low-level counterparts such as read() and write().

In multiuser environments, however, when files are typically shared and portions of files are continuously
being locked, read from, written to, and unlocked, the stream functions do not perform as well as the low-
level functions. This is because it is hard to buffer a shared file whose contents are constantly changing.

Generally, you should always use buffered stream functions when accessing nonshared files, and you should
always use the low-level functions when accessing shared files.