Pregunta

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

¿Fue útil?

Solución

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*));
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top