Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_files.h File Reference

Files configuration header. More...

#include "nilorea/n_str.h"
#include "nilorea/n_list.h"
#include "nilorea/n_log.h"
#include "dirent.h"
Include dependency graph for n_files.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  N_FILE_INFO
 common file information More...

Functions

int n_file_copy_verified (const char *from, const char *to, size_t *copied)
 Copy a file, check the copy against the original, and only then give it its name.
int n_file_read_bounded (const char *path, size_t max_size, unsigned char **out, size_t *out_len)
 read a whole file into a freshly allocated, NUL-terminated buffer, refusing a file larger than max_size bytes.
int n_file_same_content (const char *a, const char *b)
 Do two files hold the same bytes.
int n_file_write_atomic (const char *path, const unsigned char *data, size_t len, int mode)
 durably and atomically write len bytes to path: write a "<path>.tmp" sibling created with mode from the outset (POSIX; 0 or Windows = leave default), flush it to stable storage, then atomically rename it over path (MoveFileEx REPLACE_EXISTING|WRITE_THROUGH on Windows, which replaces an existing target where the CRT rename() would fail).
void n_free_file_info (void *ptr)
 free a N_FILE_INFO structure
int n_scan_dir (const char *dir, LIST *result, const int recurse)
 scan a directory and store file information in the result list

Detailed Description

Files configuration header.

Author
Castagnier Mickael
Version
1.0
Date
02/11/23

Definition in file n_files.h.