0

I implemented pset4's recover.c and it worked fine, recovering all of the images. However, when I went to check it with valgrind to see if it didn't leak any memory it spit out a bunch of errors and had a segmentation fault. I've looking around to see what might be the issue but I can't manage to fix these issues. Can someone explain to me what the problem is, or point me in the right direction?

This is my file, which recovers files correctly but crashes valgrind.

1

I fixed my problem by using freopen() instead of fclose() + fopen(). I feel a little silly because I did know of freopen(), I just thought it didn't do what I wanted because I skimmed through its docs.

I will edit my question removing my code to avoid plagiarism, but I feel people can still learn from my mistake from this comment.

1
  • god...this answer helps.. thanks..
    – Govinda
    Sep 16 '15 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .