Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Functions
tempfile.h File Reference
#include <wireshark.h>

Go to the source code of this file.

Functions

WS_DLL_PUBLIC int create_tempfile (const char *tempdir, char **namebuf, const char *pfx, const char *sfx, GError **err)
 
WS_DLL_PUBLIC char * create_tempdir (const char *parent_dir, const char *tmpl, GError **err)
 

Detailed Description

Convenience function for temporary file creation.

Function Documentation

◆ create_tempdir()

WS_DLL_PUBLIC char * create_tempdir ( const char *  parent_dir,
const char *  tmpl,
GError **  err 
)

Create a tempfile with the given parent directory (e.g. "/my/private/tmp"). The path is created using g_mkdtemp.

Parameters
parent_dir[in] If not NULL, the parent directory in which to create the subdirectory, otherwise the system temporary directory is used.
tmpl[in] A template for the temporary directory.
err[out] Any error returned by g_mkdtemp. May be NULL.
Returns
The full path of the temporary directory or NULL on error. Must be g_freed.

◆ create_tempfile()

WS_DLL_PUBLIC int create_tempfile ( const char *  tempdir,
char **  namebuf,
const char *  pfx,
const char *  sfx,
GError **  err 
)

Create a tempfile with the given prefix (e.g. "wireshark"). The path is created using g_file_open_tmp.

Parameters
tempdir[in] If not NULL, the directory in which to create the file.
namebuf[in,out] If not NULL, receives the full path of the temp file. Must be g_freed.
pfx[in] A prefix for the temporary file.
sfx[in] A file extension for the temporary file. NULL can be passed if no file extension is needed
err[out] Any error returned by g_file_open_tmp. May be NULL.
Returns
The file descriptor of the new tempfile, from mkstemps().

Create a tempfile with the given prefix (e.g. "wireshark"). The path is created using g_file_open_tmp.

Parameters
tempdir[in] If not NULL, the directory in which to create the file.
namebuf[in,out] If not NULL, receives the full path of the temp file. Must be freed.
pfx[in] A prefix for the temporary file.
sfx[in] A file extension for the temporary file. NULL can be passed if no file extension is needed
err[out] Any error returned by g_file_open_tmp. May be NULL
Returns
The file descriptor of the new tempfile, from mkstemps().