瀏覽代碼

REVIEWED: LoadText()

pull/1113/head
Ray 5 年之前
父節點
當前提交
f2247c6f0a
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. +8
    -1
      src/rlgl.h

+ 8
- 1
src/rlgl.h 查看文件

@ -3007,7 +3007,14 @@ char *LoadText(const char *fileName)
{
text = (char *)RL_MALLOC(sizeof(char)*(size + 1));
int count = fread(text, sizeof(char), size, textFile);
if (size == count) text[count] = '\0';
// WARNING: \r\n is converted to \n on reading, so,
// read bytes count gets reduced by the number of lines
if (count < size)
{
text = RL_REALLOC(text, count + 1);
text[count] = '\0';
}
}
fclose(textFile);

Loading…
取消
儲存