crun_file_manager source file
More...
#include "../inc/crun_file_manager.h"
#include "../inc/crun_audit.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
|
| char * | get_file_data (const char *filename) |
| | Read full file content into a null-terminated buffer.
|
| int | is_file_exist (const char *filename) |
| | Check if file or directory exists.
|
| const char * | get_file_home_path (const char *suffix) |
| | Build home-based absolute path using suffix.
|
| const long | get_file_size (FILE *fp) |
| | Compute total file size for opened stream.
|
| int | is_zip_archive (const char *filename) |
| | Detect whether a file is a ZIP archive using its signature.
|
| int | copy_file_to_path (const char *source_path, const char *target_path) |
| | Copy a file from source path to destination path.
|
crun_file_manager source file
- Author
- ZouariOmar zouar.nosp@m.ioma.nosp@m.r20@g.nosp@m.mail.nosp@m..com
- Version
- 0.1
- Date
- 2025-12-26
- Copyright
- Copyright (c) 2025
crun_file_manager.c
◆ CRUN_IO_BUFFER_SIZE
| #define CRUN_IO_BUFFER_SIZE 8192 |
◆ copy_file_to_path()
| int copy_file_to_path |
( |
const char * | source_path, |
|
|
const char * | target_path ) |
Copy a file from source path to destination path.
- Parameters
-
| source_path | Existing file path. |
| target_path | Destination file path. |
- Returns
- int EXIT_SUCCESS on success, EXIT_FAILURE otherwise.
◆ get_file_data()
| char * get_file_data |
( |
const char * | filename | ) |
|
Read full file content into a null-terminated buffer.
- Parameters
-
| filename | Absolute/relative file path. |
- Returns
- char* Allocated buffer (caller frees), or NULL on failure.
◆ get_file_home_path()
| const char * get_file_home_path |
( |
const char * | suffix | ) |
|
Build home-based absolute path using suffix.
- Parameters
-
| suffix | Path suffix appended to OS home location. |
- Returns
- const char* Allocated path buffer (caller frees), or NULL on failure.
◆ get_file_size()
| const long get_file_size |
( |
FILE * | fp | ) |
|
Compute total file size for opened stream.
- Parameters
-
- Returns
- long File size in bytes, -1 on failure.
◆ is_file_exist()
| int is_file_exist |
( |
const char * | filename | ) |
|
Check if file or directory exists.
- Parameters
-
- Returns
- int Non-zero if path exists, zero otherwise.
◆ is_zip_archive()
| int is_zip_archive |
( |
const char * | filename | ) |
|
Detect whether a file is a ZIP archive using its signature.
- Parameters
-
| filename | Path to the file to inspect. |
- Returns
- int Non-zero if ZIP signature is detected, zero otherwise.