#pragma warning (disable: 4715) #pragma warning (disable: 4172) /* builds shader file into a unsigned char *blahShader so blahshader = load_shader("shader.shd"); or whatever.. */ #include #include #include #include typedef unsigned char uchar; unsigned char *load_shader(char *filename) { FILE *fp; uchar testbuffer[9999]; uchar copybuff[256]; char buff[256]; char *pdest; char str[] = ";"; char comment[] = "#"; ZeroMemory(testbuffer, 9999); ZeroMemory(copybuff, 256); fp = fopen(filename, "r"); if (fp == NULL) printf("fail\n"); while(!feof(fp)) { fscanf(fp, "%[^\n]\n", buff); pdest = strstr(buff, comment); if (pdest == NULL) strcat(testbuffer, buff); if (strcmp(buff, "END") == 0) { printf("%s\n", testbuffer); return testbuffer; } } }