gra-projekt/Implementierung/lib/io.h

34 lines
No EOL
789 B
C

#ifndef IO_H
#define IO_H
#define _XOPEN_SOURCE
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/sysinfo.h>
/**
* @brief Open a file and load its stats
*
* @param path the filepath
* @param file where the pointer of the file handle should be stored
* @param file_stat pointer to a stat struct
* @return true it worked
* @return false there was an error
*/
bool open_file(const char* path, FILE** file, struct stat* file_stat);
/**
* @brief reads a file at a path
*
* @param path the filepath
* @param size a pointer where the size of the result should be stored
* @return pointer to the raw data or NULL on errors
*/
uint8_t* read_file(const char* path, size_t* size);
#endif // IO_H