This commit is contained in:
Blaise Tine
2019-11-25 18:48:48 -05:00
parent e1197575e6
commit e3b8b375ef
21 changed files with 22055 additions and 4 deletions

View File

@@ -0,0 +1,40 @@
#include <CL/cl.h>
#include <stdio.h>
#include <stdlib.h>
#include "ocl.h"
char* readFile(char* fileName)
{
FILE* fp;
fp = fopen(fileName,"r");
if(fp == NULL)
{
printf("Error 1!\n");
return NULL;
}
fseek(fp,0,SEEK_END);
long size = ftell(fp);
rewind(fp);
char* buffer = (char*)malloc(sizeof(char)*(size+1));
if(buffer == NULL)
{
printf("Error 2!\n");
fclose(fp);
return NULL;
}
size_t res = fread(buffer,1,size,fp);
if(res != size)
{
printf("Error 3!\n");
fclose(fp);
return NULL;
}
buffer[size] = 0;
fclose(fp);
return buffer;
}