kinda forgot the point of loadFile()

This commit is contained in:
Josh Holtrop 2011-04-29 17:24:01 -04:00
parent c6e51524e9
commit 9a0ffa8cbe

View File

@ -1,6 +1,7 @@
#define GL_GLEXT_PROTOTYPES
#include <sys/stat.h>
#include <fcntl.h>
#include <SDL/SDL.h>
#include <GL/gl.h>
#include <GL/glu.h>
@ -21,6 +22,9 @@ char * loadFile(const char *fname)
if (st.st_size <= 0)
return NULL;
char * buff = new char[st.st_size + 1];
int fd = open(fname, O_RDONLY);
read(fd, buff, st.st_size);
close(fd);
buff[st.st_size] = '\0';
return buff;
}