Click to See Complete Forum and Search --> : file functions


jshyus
September 17th, 2001, 07:59 AM
there are two sets of functions that handles files. "lseek" "fseek", "read" "fread", "open" "fopen" ...
These functions have the same functionality, except one set uses file handle which is int, the other set uses FILE*. Is there any other differece other than they accept different parameters? Why do we have two sets of file handling functions?

Virtuality
September 17th, 2001, 10:55 PM
From the MSDN:

Stream I/O (fread, fwrite, etc.)
These functions process data in different sizes and formats, from single characters to large data structures. They also provide buffering, which can improve performance. The default size of a stream buffer is 4K. These routines affect only buffers created by the run-time library routines, and have no effect on buffers created by the operating system.

Low-level I/O (lseek, etc.)
These functions invoke the operating system directly for lower-level operation than that provided by stream I/O. Low-level input and output calls do not buffer or format data.