I keep getting an error saying that I have too many files open when trying to open a file. I have a function that gets called a lot of times and I'm trying to trace some stuff going on in that function. So when I enter the function, I open a file to append to, write some stuff to it, and then close it. After a while, when I try to open the file to append to, I get a seg fault because too many files are open. My code is basically:
is there some other way I'm supposed to close the file?
FILE *fp = fopen(outFile, "a+");
printf("Error opening file\n");