ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Functions
file.c File Reference

File utilities. More...

#include <log/file.h>
#include <mm/mm.h>
#include <stdarg.h>
Include dependency graph for file.c:

Functions

void * file_memory_load (FILE *f, int64_t *f_size_p)
 Load a whole file content in a mm_alloc-ed memory buffer. More...
 
FILE * file_open (const char *open_type, const char *fmt,...)
 A version of fopen() which accepts a printf style format string. More...
 

Detailed Description

File utilities.

Some file utility functions

Function Documentation

◆ file_memory_load()

void* file_memory_load ( FILE *  f,
int64_t *  f_size_p 
)

Load a whole file content in a mm_alloc-ed memory buffer.

Parameters
[in]fthe file to load
[out]f_size_pa pointer to a variable which will contain with the loaded file size
Returns
a mm_alloc-ed buffer filled in with the file content, or NULL if a read error happened

◆ file_open()

FILE* file_open ( const char *  open_type,
const char *  fmt,
  ... 
)

A version of fopen() which accepts a printf style format string.

Parameters
open_typea string which controls how the file is opened (see fopen())
fmtthe file name expressed as a printf style format string
...the list of additional arguments used in fmt (see printf())