use stdio i/o functions

This commit is contained in:
Josh Holtrop committed 2011-05-09 17:31:02 -04:00
1 parent 956f249d54
commit 9e6003a0d2
1 file changed
+3 -4
+3 -4
View File
@@ -2,7 +2,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h>
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include "glslUtil.h" #include "glslUtil.h"
@@ -18,9 +17,9 @@ static char *loadFile(const char *fname)
if (st.st_size <= 0) if (st.st_size <= 0)
return NULL; return NULL;
char * buff = malloc(st.st_size + 1); char * buff = malloc(st.st_size + 1);
int fd = open(fname, O_RDONLY); FILE *fil = fopen(fname, "r");
read(fd, buff, st.st_size); fread(buff, st.st_size, 1, fil);
close(fd); fclose(fil);
buff[st.st_size] = '\0'; buff[st.st_size] = '\0';
return buff; return buff;
} }