use stdio i/o functions

This commit is contained in:
Josh Holtrop 2011-05-09 17:31:02 -04:00
parent 956f249d54
commit 9e6003a0d2

View File

@ -2,7 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#include <string.h>
#include "glslUtil.h"
@ -18,9 +17,9 @@ static char *loadFile(const char *fname)
if (st.st_size <= 0)
return NULL;
char * buff = malloc(st.st_size + 1);
int fd = open(fname, O_RDONLY);
read(fd, buff, st.st_size);
close(fd);
FILE *fil = fopen(fname, "r");
fread(buff, st.st_size, 1, fil);
fclose(fil);
buff[st.st_size] = '\0';
return buff;
}