In C, parsing a string of multiple whitespace separated integers

前端 未结 5 971
生来不讨喜
生来不讨喜 2020-12-11 19:26

I am attempting to use C to parse a file containing multiple rows of whitespace separated integers into a dynamic array of dynamic int arrays. Each row will be an array in t

5条回答
  •  春和景丽
    2020-12-11 20:03

    You should use :

    lineBuffer = (char *)malloc(sizeof(BUFFER_SIZE + 1));
    

    than :

    char lineBuffer[BUFFER_SIZE];
    

    Your stack will thanks you !

提交回复
热议问题