History:
freadln
size_t freadln( char *_str, FILE *_file )
Přečte řádek ze souboru končící znakem 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