//Data types #include #include #include #include #include #include //Streams #include #include #include #include #include #include char* readShader(char* filename) { FILE* infile; int tempint; tempint = fopen_s(&infile, filename, "r"); if (tempint != 0) { std::cout << "Error " << tempint << " when reading file " << filename << std::endl; return "Error reading file."; } boolean loop = true; int loops = 0; char* text = ""; char temptext[2]; int index = 0; while (loop) { fgets(temptext, 2, infile); //std::cout << temptext; if (temptext != NULL && std::feof(infile) != 1) { //this next section is what causes errors if (loops == 0) { //strcpy_s(text, 2, temptext); text[0] = temptext[0]; std::cout << text; } else { //strcat_s(text, 2, temptext); text[1] += temptext[1]; std::cout << text; } loops++; } else { loop = false; } } fclose(infile); return text; }