If you don't want fclose(f) to flush the file, just close the underlying file descriptor, then fclose() doesn't have anything to hang upon.