Newer
Older
Import / applications / HighwayDash / ports / Platform / Qt / Resources.cpp
@John Ryland John Ryland on 22 Dec 2020 418 bytes import NUC files
#include <vector>
#include <string>
#include <cstdio>


void LoadPlatformFile(const char* filename, std::vector<uint8_t>& data)
{
  std::string resPath = "../../Data/";
  resPath += filename;
  FILE* f = fopen(resPath.c_str(), "rb");
  if (f) {
    fseek(f, 0, SEEK_END);
    size_t siz = ftell(f);
    fseek(f, 0, SEEK_SET);
    data.resize(siz);
    size_t r = fread(data.data(), siz, 1, f);
    fclose(f);
  }
}