libite
Functions
fopenf.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
Include dependency graph for fopenf.c:

Functions

FILE * vfopenf (const char *mode, const char *fmt, va_list ap)
 Similar to fopenf() except it takes a va_list argument. More...
 
FILE * fopenf (const char *mode, const char *fmt,...)
 Open a file based on the formatted string and optional arguments. More...
 

Detailed Description

Author
Joachim Wiberg
Date
2021

Function Documentation

◆ fopenf()

FILE* fopenf ( const char *  mode,
const char *  fmt,
  ... 
)

Open a file based on the formatted string and optional arguments.

Parameters
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.

This function is an extension to the fopen() family, lessening the burden of first having to compose the filename from parts in a seprate buffer.

Returns
Upon successful completion, fopenf() returns a FILE pointer. Otherwise, NULL is returned and errno is set to indicate the error.

◆ vfopenf()

FILE* vfopenf ( const char *  mode,
const char *  fmt,
va_list  ap 
)

Similar to fopenf() except it takes a va_list argument.

Parameters
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
apList of variable arguemnts from va_start().

See fopenf() for details.

Returns
a FILE pointer, or NULL on error.