The filebuf_open function opens a new file buffer for a previously opened file. It returns a new buffer structure. Buffered files provide more efficient file access by guaranteeing the use of buffered file I/O in environments where it is not supported by the operating system.
filebuf *filebuf_open(SYS_FILE fd, int sz);
A pointer to a new buffer structure to hold the data if successful, or NULL if no buffer can be opened.
SYS_FILE fd is the platform-independent file descriptor of the file that has already been opened.
int sz is the size, in bytes, to be used for the buffer.
filebuf *buf = filebuf_open(fd, FILE_BUFFERSIZE); if (!buf) { system_fclose(fd); }
filebuf_getc() Function, filebuf_buf2sd() Function, filebuf_close() Function, filebuf_open_nostat() Function