.TH MPU_TMPFILE 3 "August 2026" "libmpuio" "LIBMPUIO Programmer's Manual" .SH NAME mpu_tmpfile \- create an anonymous temporary LIBMPUIO real-file stream .SH SYNOPSIS .nf #include mpu_FILE *mpu_tmpfile( void ); .fi .SH DESCRIPTION .B mpu_tmpfile creates a temporary POSIX file, removes its directory entry immediately, and returns a LIBMPUIO real-file stream opened for both reading and writing. The file therefore has no persistent pathname after successful creation and is removed automatically when the last descriptor is closed. .PP The returned stream is a normal descriptor-backed LIBMPUIO stream. Text operations convert UCS-2 to/from UTF-8; raw .BR mpu_fread (3) and .BR mpu_fwrite (3) operate on bytes. .SH RETURN VALUE A stream pointer is returned on success. NULL is returned on failure and .B errno is set. .SH NOTES The implementation uses the system temporary directory convention and creates an exclusive temporary file before unlinking it. The descriptor is owned by the returned stream and is closed by .BR mpu_fclose (3). .SH EXAMPLE .nf mpu_FILE *fp = mpu_tmpfile(); __mpu_char16_t line[32]; if( fp != NULL ) { mpu_fputs( MPU_UCS2("temporary"), fp ); mpu_rewind( fp ); mpu_fgets( line, 32, fp ); mpu_fclose( fp ); } .fi .SH SEE ALSO .BR libmpuio (3), .BR mpu_fopen (3), .BR mpu_fclose (3), .BR mpu_fseek (3)