#include #define BUFSIZE 5242880 int main( argc, argv ) int argc; char *argv[]; { char buffer[BUFSIZE], digitstr[64]; char *bufptr, *numptr; int nread, i; numptr = digitstr; while (( nread = fread( buffer, 1, BUFSIZE, stdin )) > 0 ) { bufptr = buffer; i = 0; while ( i < nread ) { if ( *bufptr >= 0x30 && *bufptr <= 0x39 ) *numptr++ = *bufptr; else if ( numptr > digitstr ) { *numptr = 0; printf( "%s\n", digitstr ); numptr = digitstr; } bufptr++; i++; } } /* update: need this list bit in case last char in the stream is a digit */ if ( numptr > digitstr ) { *numptr = 0; printf( "%s\n", digitstr ); } }