3 ms·
Solve in the wild by never clipping the output of things like fgets() int ch = fgetc(src); if(ch == EOF) goto oops_eof; out++; *ptr++ =
by Gibbon1 3y ago
Solve in the wild by never clipping the output of things like fgets()
int ch = fgetc(src);
if(ch == EOF)
goto oops_eof;
out++;
*ptr++ = ch; *ptr = '\0';
if(strchr(s, ch))
return out;
or maybe
int ch;
if((ch = fgetc(src)) == EOF)
goto oops_eof;
*ptr[out++] = ch; *ptr[out] = '\0';
if(strchr(s, ch))
return out;