Generic bin parser

This commit is contained in:
Ben V. Brown 2023-08-01 17:40:59 +10:00
parent cf00bedeaf
commit 9893a49376
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include "parse_file.h"
int bin_file_parse(const char* file_path_on_disk,
uint8_t** payload,
size_t* payload_length,
size_t* payload_address) {
// Bin files a dumb so we cant do any fancy logic
*payload_address = 0; // We cant know otherwise
ssize_t len = get_file_contents(file_path_on_disk, payload);
if (len > 0) {
*payload_length = len;
}
return len;
}

View File

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>