VMUPro SDK v1.0.0
Application Development SDK for the VMUPro
|
VMUPro File System Utilities. More...
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Functions | |
bool | vmupro_file_exists (const char *filename) |
Check if a file exists. | |
bool | vmupro_folder_exists (const char *path) |
Check if a folder exists. | |
size_t | vmupro_get_file_size (const char *filename) |
Get the size of a file. | |
bool | vmupro_read_file_complete (const char *filename, uint8_t *buffer, size_t *file_size) |
Read an entire file into memory. | |
bool | vmupro_read_file_bytes (const char *filename, uint8_t *buffer, uint32_t offset, int num_bytes) |
Read specific bytes from a file. | |
bool | vmupro_write_file_complete (const char *filename, const uint8_t *data, size_t size) |
Write data to a file completely. | |
bool | vmupro_write_file_bytes (const char *filename, const uint8_t *data, uint32_t offset, size_t length) |
Write data to a file at a specific offset. | |
unsigned long | crc32 (int crc, uint8_t *buf, int len) |
Calculate CRC32 checksum. | |
VMUPro File System Utilities.
This header provides file system utility functions for the VMUPro SDK. It includes functions for file operations such as checking file existence, reading files, getting file information, and data integrity functions.
Definition in file vmupro_file.h.
unsigned long crc32 | ( | int | crc, |
uint8_t * | buf, | ||
int | len | ||
) |
Calculate CRC32 checksum.
Calculates a 32-bit cyclic redundancy check (CRC32) for the given data buffer. This function is available in the VMUPro SDK for data integrity verification.
crc | Initial CRC value (use 0 for new calculation, or previous result for continuation) |
buf | Pointer to data buffer to calculate CRC for |
len | Number of bytes in the buffer |
bool vmupro_file_exists | ( | const char * | filename | ) |
Check if a file exists.
Checks whether a file exists at the specified path on the SD card file system.
filename | Path to the file to check (null-terminated string) |
bool vmupro_folder_exists | ( | const char * | path | ) |
Check if a folder exists.
Checks whether a folder/directory exists at the specified path on the SD card file system.
path | Path to the folder to check (null-terminated string) |
size_t vmupro_get_file_size | ( | const char * | filename | ) |
Get the size of a file.
Returns the size of the specified file in bytes.
filename | Path to the file (null-terminated string) |
bool vmupro_read_file_bytes | ( | const char * | filename, |
uint8_t * | buffer, | ||
uint32_t | offset, | ||
int | num_bytes | ||
) |
Read specific bytes from a file.
Reads a specified number of bytes from a file starting at a given offset. The buffer must be pre-allocated by the caller.
filename | Path to the file to read (null-terminated string) |
buffer | Pre-allocated buffer to store the read data |
offset | Byte offset in the file to start reading from |
num_bytes | Number of bytes to read |
bool vmupro_read_file_complete | ( | const char * | filename, |
uint8_t * | buffer, | ||
size_t * | file_size | ||
) |
Read an entire file into memory.
Reads the complete contents of a file into a dynamically allocated buffer. The caller is responsible for freeing the allocated memory.
filename | Path to the file to read (null-terminated string) | |
[out] | buffer | Pointer to buffer pointer (will be allocated by this function) |
[out] | file_size | Pointer to store the file size in bytes |
bool vmupro_write_file_bytes | ( | const char * | filename, |
const uint8_t * | data, | ||
uint32_t | offset, | ||
size_t | length | ||
) |
Write data to a file at a specific offset.
Writes data to a file starting at the specified byte offset. The file must already exist or be created beforehand. This is useful for updating specific sections of a file without rewriting the entire file.
filename | Path to the file to write (null-terminated string) |
data | Pointer to the data buffer to write |
offset | Byte offset in the file to start writing at |
length | Number of bytes to write |
bool vmupro_write_file_complete | ( | const char * | filename, |
const uint8_t * | data, | ||
size_t | size | ||
) |
Write data to a file completely.
Writes the entire data buffer to a file, creating or overwriting the file. This function handles opening, writing, and closing the file automatically.
filename | Path to the file to write (null-terminated string) |
data | Pointer to the data buffer to write |
size | Number of bytes to write |