I have a chat system that I have made and the server supports reserved usernames. Everytime a user logs in the system opens the user file and checks for the user permissions. After several times of doing this the fopen command seg faults. I do not know why as I have examined the code and it is properly being closed everytime.
I even tried leaving the file open throughout program execution and using fseek to reset the position to 0 in the file. However now the fseek causes the crash and it is not ever closed.
I was wondering if anyone had any idea as to why this would happen
pseudocode would be
Code:FILE *data = NULL; data = fopen(filename,"r"); if(data == NULL) { return -1; } while(!feof(data)) { //read data with fgets in this case } fclose(data)