我的代码不断从内部 c 库中抛出分段错误,我的代码如下:
char *vertexShaderCode = (char *)calloc(1024, sizeof(char));
FILE *shaderFile;
shaderFile = fopen("./shaders/vertex.glsl", "r");
if(shaderFile)
{
//TODO: load file
for (char *line; !feof(shaderFile);)
{
fgets(line, 1024, shaderFile);
strcat(vertexShaderCode, line);
}
它旨在将文件中的所有数据作为 ac 字符串逐行加载。谁能帮忙?