You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
471 B

  1. #ifndef _FILEDATA_H_
  2. #define _FILEDATA_H_
  3. #include <stdint.h>
  4. struct databuf {
  5. uint32_t size; // allocation size
  6. uint32_t length; // used size
  7. uint8_t data[0];
  8. };
  9. struct databuf * dbuf_alloc(uint32_t size);
  10. void dbuf_free(struct databuf *dbuf);
  11. int file_getsize(const char *filename, uint32_t *size);
  12. int file_read(const char *filename, struct databuf *dbuf);
  13. int file_write(const char *filename, struct databuf *dbuf);
  14. #endif /* _FILEDATA_H_ */