Plaster

c
#include <stdlib.h> #include <unistd.h> #include <fcntl.h> char * loadfile ( char * filename ) { struct stat fileinfo; stat ( filename, &fileinfo ); char * file; file = ( char * ) malloc ( fileinfo.st_size ); int fd; fd = open ( filename, O_RDONLY ); if ( fd == -1 ) { return "The function loadfile failed at opening the file,\n maybe due to a bad filename or lack of permission"; } read ( fd, file, fileinfo.st_size ); close ( fd ); return file; }