hi,
if the input consists only of integers sometimes (few numbers per line)
a getchar based integer reading is faster (and simpler) than the gets + char * based.
here is the subroutine:
#define ITYPE unsigned int
#define GETCHAR getchar_unlocked
#define DIG( a ) ( ( ( a ) >= '0' ) && ( ( a ) <= '9' ) )
ITYPE GETNUM ( void )
{
int
i ;
ITYPE
j ;
i = GETCHAR () ;
while ( ! DIG( i ) )
i = GETCHAR () ;
j = ( i - '0' ) ;
i = GETCHAR () ;
while ( DIG( i ) )
{
j = ( ( j << 1 ) + ( j << 3 ) + ( i - '0' ) ) ;
i = GETCHAR () ;
}
return ( j ) ;
}
read the manual pages of getchar_unlocked too (in case of nx).
good luck, csaba noszaly
ps: low level io is dirty: too much assumptions about io size, too fast, too few handwork 