DOS/4G and DOS/4GW FAQ:File I/O

The best way to speed up DOS file I/O in DOS/4G is to write large
blocks (up to 65535 bytes, or the largest number that will fit in a 16-bit
int) at a time from a buffer in low memory. In this case, DOS/4G has to
copy the least amount of data and make the fewest number of DOS calls in
order to process the I/O request.

Low memory is allocated through Interrupt 31h/0100h (Allocate DOS
Memory Block). You can convert the real mode segment address returned by
Interrupt 31h/100h to a pointer (suitable for passing to setvbuf()) by
shifting it left four bits.