C functions to access a memory buffer as a FILE