82.3.2 Opening a File for Buffered File I/O

The multimedia file I/O manager provides several ways to set up and use buffered file I/O. The main distinction between these different approaches is whether the file I/O manager or the application allocates the buffer—either the file I/O manager or the application can allocate the I/O buffer. Unless you want to directly access the I/O buffer or open a memory file, you should let the file I/O manager allocate the buffer. For more information on directly accessing an I/O buffer and using memory files, see “Directly Accessing a File I/O Buffer” and “Performing File I/O on Memory Files,” both later in this chapter.

A buffer allocated by the file I/O manager is called an internal buffer. To open a file for buffered I/O using an internal buffer, specify the MMIO_ALLOCBUF flag with the mmioOpen function when you open the file. Once a file is opened for buffered I/O, the buffer is essentially transparent to the application. You can read, write, and seek the same way as with unbuffered I/O.