문제

I am trying to store data from a CSV file and ran into an access violation. The first image was shows how the memory is allocated, the second shows the problem area and the third is the spot in the csv where the problem occurred. Any help is appreciated.

enter image description here snip of my VS

data at problem location

도움이 되었습니까?

해결책

It looks like the first loop that does the "pre-allocation" may have an error. The following allocation:

AllCurrentData[newLineCOunt].data = malloc(COLUMNS * sizeof(char));

should, I believe, be this:

AllCurrentData[newLineCOunt].data = malloc(COLUMNS * sizeof(char*));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top