How about adding an SDL_RWreadLine function?

I’ve needed to replace my use of fgets (to read a line of text from a file) with SDL functions. There doesn’t seem to be an equivalent function in SDL so I’ve modified the C code for the fgets function to make the following, and wondered if that would be a useful addition to SDL?

char* SDL_RWreadLine(char *szLine, int iMax, SDL_RWops *pFile)
{
	int		iReturn;
	char	ch;
	char*	p;

	// get 'max' bytes or up to a newline
	for (p = szLine, iMax--; iMax > 0; iMax--) 
	{
		// read the next character
		iReturn = SDL_RWread(pFile, &ch, sizeof(ch), 1);

		// error, or reached the end of the file?
		if (iReturn == 0
		 || ch == 0)
		{
			return NULL;
		}

		// append this character
		*p++ = ch;

		// end of line?
		if (ch == '\n')
		{
			break;
		}
	}

	// null terminate
	*p = 0;

	// return
	if (p == szLine)
	{
		return NULL;
	}

	return (p);
}

I think because this can be easily done within any app without cross-platform dependency, I’m not sure it’ll get added.

Not as useful as SDL_RWrename(), SDL_RWdelete(), and SDL_RWfindfirst(), however… hint hint