0 Members and 1 Guest are viewing this topic.
I Fear that if i do that after formating it will force me to update to 3.2...
"3.0.2.1793" dosnt haves anyproblems ammirite...?
The fgets function seems to have a glitch:Code: [Select]char *fgets(char *str, int num, FILE *str2eam) { char *str2 = str; while (num--) { char c = fgetc(str2eam); //THIS IS THE BUGGY LINE if (c == EOF) { *str2 = '\0'; return NULL; } *str2++ = c; if (c == '\n') break; } *str2 = '\0'; return str;}The c variable should be specified as an int, not a char -- it looks like the compiler treated the char as unsigned and optimized out the return NULL entirely! Plus, it is possible that an 0xFF character exists in the file, so signed char is not the way to go.
char *fgets(char *str, int num, FILE *str2eam) { char *str2 = str; while (num--) { char c = fgetc(str2eam); //THIS IS THE BUGGY LINE if (c == EOF) { *str2 = '\0'; return NULL; } *str2++ = c; if (c == '\n') break; } *str2 = '\0'; return str;}
char *fgets(char *str, int num, FILE *str2eam) { char *str2 = str; while (num--) { int c = fgetc(str2eam); if (c == EOF) { if (str2 != str) break; return NULL; } *str2++ = c; if (c == '\n') break; } *str2 = '\0'; return str;}