Mercurial > LightClone
view LightClone/Source/Util.cpp @ 19:51718795f019
Adding event handling & drag and drop to GuiInterface
author | koryspansel |
---|---|
date | Thu, 15 Sep 2011 12:13:40 -0700 |
parents | 7e3a0ae9c016 |
children | 00d17d8f407d |
line wrap: on
line source
/* * Util */ #include "Util.h" #include <stdio.h> /* * LoadFile */ Buffer LoadFile(const char* pName) { uint8* pData = NULL; uint32 nSize = 0; FILE* pFile = NULL; if(fopen_s(&pFile, pName, "rt") == 0) { fseek(pFile, 0, SEEK_END); nSize = (uint32)ftell(pFile); fseek(pFile, 0, SEEK_SET); if(nSize > 0) { pData = new uint8[nSize]; uint32 nCount = (uint32)fread(pData, sizeof(uint8), nSize, pFile); if(nCount != nSize) { delete[] pData; pData = NULL; nSize = 0; } } fclose(pFile); } return Buffer(pData, nSize); }