History: freadln
size_t freadln( char *_str, FILE *_file )
Reads line from the file ending with characters CR / LF / NULL.
Code
size_t freadln( char *_str, FILE *_file )
{
	u_int i;
	bool tx = false;
	char chr = 0;
	for( i=0; fread( &chr, 1, 1, _file ) > 0; )
	{
		if( tx == false )
		{
			if( chr != 13 && chr != 10 )
				tx = true;
			else
				continue;
		}

		if( tx == true && ( chr == 13 || chr == 10 || chr == 0 ) ) break;

		_str[i] = chr;
		i++;
	}
	_str[i] = 0;
	return i;
}
Code.Tode.cz by Henry - 2014
Získejte registraci domén s tld .online, .space, .store, .tech zdarma!
Stačí si k jedné z těchto domén vybrat hosting Plus nebo Mega a registraci domény od nás dostanete za 0 Kč!
Objednat