On another question, Jerry Coffin pointed out the following:
It's (probably) not really related to your question, but
while (!feof(fileptr)){
is pretty much a guaranteed bug.
I figured I would start a separate question since that comment is somewhat off-topic. Could someone explain this to me? This was the first program I've written in straight C before.