Oyranos  git-devel
Oyranos is a full featured Color Management System
Typedefs | Functions

File I/O. More...

Collaboration diagram for OyjlCore I/O:

Typedefs

typedef int(* oyjlFileNameCheck_f) (const char **full_filename, int write_size)
 custom file name checker function type More...
 

Functions

char * oyjlReadFileStreamToMem (FILE *fp, int *size)
 read FILE into memory More...
 
char * oyjlReadFileP (FILE *fp, int *size_ptr, void *(*alloc)(size_t), const char *file_name)
 Read a local FILE pointer to memory. More...
 
FILE * oyjlFopen (const char *file_name, const char *mode)
 wrapper for fopen() More...
 
char * oyjlReadFile (const char *file_name, int flags, int *size_ptr)
 read local file into memory More...
 
int oyjlHasApplication (const char *app_name)
 detect program More...
 
char * oyjlReadCommandF (int *size, const char *mode, void *(*alloc)(size_t), const char *format,...)
 Read a stream from shell command. More...
 
int oyjlReadFunction (int argc, const char **argv, int(*callback)(int argc, const char **argv), void *(*alloc)(size_t), int *size_stdout, char **data_stdout, int *size_stderr, char **data_stderr)
 Read a stream from a function. More...
 
int oyjlWriteFile (const char *filename, const void *mem, int size)
 write memory to FILE More...
 

Detailed Description

File I/O.

Basic C FILE input and output is provided by oyjlWriteFile(), oyjlReadFile() and oyjlReadFileStreamToMem().

Typedef Documentation

◆ oyjlFileNameCheck_f

typedef int(* oyjlFileNameCheck_f) (const char **full_filename, int write_size)

custom file name checker function type

This function allows to implement file i/o access policies for the oyjlReadFile(), oyjlWriteFile() and oyjlIsFile() funtions.

Parameters
[in,out]filenamefilename can be replaced
[in]sizeis write file size otherwise read from
Returns
< 0: issue, 0: fine, > 0: error

Function Documentation

◆ oyjlFopen()

FILE * oyjlFopen ( const char *  file_name,
const char *  mode 
)

wrapper for fopen()

Examples:
oyranos_cmm_oJPG.c.

◆ oyjlHasApplication()

int oyjlHasApplication ( const char *  app_name)

detect program

Search for a command in the executeable path. It resembles 'which'.

Parameters
[in]app_nameapplication name withou path
Returns
1 - if found, otherwise 0
Version
Oyjl: 1.0.0
Date
2022/04/23
Since
2022/04/23 (Oyjl: 1.0.0)

◆ oyjlReadCommandF()

char* oyjlReadCommandF ( int *  size,
const char *  mode,
void *(*)(size_t)  alloc,
const char *  format,
  ... 
)

Read a stream from shell command.

param[in] mode Is passed to popen. optional; Can contain dot '.' separated attributes:

  • verbose - print infos to stderr. Example: (..., mode = "r.verbose", ...)

References oyjlStringCopy().

◆ oyjlReadFile()

char * oyjlReadFile ( const char *  file_name,
int  flags,
int *  size_ptr 
)

read local file into memory

uses malloc()

◆ oyjlReadFileP()

char * oyjlReadFileP ( FILE *  fp,
int *  size_ptr,
void *(*)(size_t)  alloc,
const char *  file_name 
)

Read a local FILE pointer to memory.

Referenced by oyjlReadFunction().

◆ oyjlReadFileStreamToMem()

char* oyjlReadFileStreamToMem ( FILE *  fp,
int *  size 
)

read FILE into memory

allocators are malloc()/realloc()

◆ oyjlReadFunction()

int oyjlReadFunction ( int  argc,
const char **  argv,
int(*)(int argc, const char **argv)  callback,
void *(*)(size_t)  alloc,
int *  size_stdout,
char **  data_stdout,
int *  size_stderr,
char **  data_stderr 
)

Read a stream from a function.

Read stdout and stderr.

References oyjlReadFileP().

◆ oyjlWriteFile()

int oyjlWriteFile ( const char *  filename,
const void *  mem,
int  size 
)

write memory to FILE