@Quzah: yeah, I just figured the crash has something to do with the struct. And yeah, maybe I shouldn't have included that menu thingy when I posted my code.
Now what to do next? It seems Adak's hypothesis is right. But I'm not quite sure which part of my code I should change to make the buffer fit my struct. Any tips? I want to insist on putting 7 data in my struct by the way (and sorry about the inconsistency in my posts...struct originally had 4 data only but now it has 7). What should I do with the j? I already tried Adak's advice but it seems to lack some more adjustments.