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

Functions

char * vreadsnf (char *line, size_t len, const char *fmt, va_list ap)
 Similar to readsnf() except it takes a va_list argument. More...
 
char * readsnf (char *line, size_t len, const char *fmt,...)
 Read first line from a file composed from fmt and optional args. More...
 
int writesf (const char *str, const char *mode, const char *fmt,...)
 Write a string buffer to a file composed from fmt and optional args. More...
 
int vreadllf (long long *value, const char *fmt, va_list ap)
 Same as readllf() except it takes a va_list argument.
 
int readllf (long long *value, const char *fmt,...)
 Read 64-bit integer value from a file composed from fmt and optional args. More...
 
int readdf (int *value, const char *fmt,...)
 Read integer value from a file composed from fmt and optional args. More...
 
int writellf (long long value, const char *mode, const char *fmt,...)
 Write 64-bit integer value to a file composed from fmt and optional args. More...
 
int writedf (int value, const char *mode, const char *fmt,...)
 Write integer value to a file composed from fmt and optional args. More...
 

Detailed Description

Author
Joachim Wiberg
Date
2023

Function Documentation

◆ readdf()

int readdf ( int *  value,
const char *  fmt,
  ... 
)

Read integer value from a file composed from fmt and optional args.

Parameters
valuePointer to where to store read integer value.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

◆ readllf()

int readllf ( long long *  value,
const char *  fmt,
  ... 
)

Read 64-bit integer value from a file composed from fmt and optional args.

Parameters
valuePointer to where to store read 64-bit integer value.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

◆ readsnf()

char* readsnf ( char *  line,
size_t  len,
const char *  fmt,
  ... 
)

Read first line from a file composed from fmt and optional args.

Parameters
linePointer to line buffer.
lenSize of line buffer.
fmtFormatted string to be composed into a pathname.
Returns
On success, this function returns the line read from the file, with any trailing '
' chomp()ed out. On error, NULL.

◆ vreadsnf()

char* vreadsnf ( char *  line,
size_t  len,
const char *  fmt,
va_list  ap 
)

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

Parameters
linePointer to line buffer.
lenSize of line buffer.
fmtFormatted string to be composed into a pathname.
apList of variable arguemnts from va_start().

For details, see readsnf().

Returns
same as readsnf().

◆ writedf()

int writedf ( int  value,
const char *  mode,
const char *  fmt,
  ... 
)

Write integer value to a file composed from fmt and optional args.

Parameters
valueInteger value to write.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

◆ writellf()

int writellf ( long long  value,
const char *  mode,
const char *  fmt,
  ... 
)

Write 64-bit integer value to a file composed from fmt and optional args.

Parameters
value64-bit integer value to write.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

◆ writesf()

int writesf ( const char *  str,
const char *  mode,
const char *  fmt,
  ... 
)

Write a string buffer to a file composed from fmt and optional args.

Parameters
strPointer to string buffer, may be multiple lines.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.