X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd588,75064a58c47bba35 X-Google-Attributes: gidfd588,public X-Google-ArrivalTime: 1994-02-11 06:46:33 PST Newsgroups: alt.ascii-art.animation Path: gmd.de!xlink.net!howland.reston.ans.net!agate!ames!sgiblab!twg.com!eco.twg.com!psinntp!lehman.com!newshost!rfb From: rfb@lehman.com (Rick Busdiecker) Subject: Re: Slow down the animation In-Reply-To: grapple@netcom.com's message of Wed, 9 Feb 1994 09:58:25 GMT To: grapple@netcom.com (gRaPpLe) Message-ID: Lines: 114 Sender: news@lehman.com (News) Nntp-Posting-Host: fnord Organization: Lehman Brothers, Inc. References: Date: Fri, 11 Feb 1994 14:46:33 GMT In article grapple@netcom.com (gRaPpLe) writes: Newsgroups: alt.ascii-art.animation From: grapple@netcom.com (gRaPpLe) Organization: The Corner Of B & Kelly Date: Wed, 9 Feb 1994 09:58:25 GMT Most of the animation with goes by too quickly for me to read text and such. Is there a way to cat the file slowly? I wrote a quick hack called scat that does does this. It does character by character I/O with a delay function called between characters. In fact, the call to usleep() in delay() is currently commented out because it was slow enough just forcing things to be character by character. Rick - - - - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - - - /* -*- Mode: C -*- */ /* * scat - intentionally slow version of cat * * This code has been put in the public domain by the author. * */ static const char RCS_Id [] = "$Id: scat.c,v 1.3 1993/12/13 15:13:48 rfb Exp $"; #include #include #include static char* program_name = NULL; static void delay (void); int main (int, char**); static void process_file (const char* file); static void process_stream (FILE* stream); static void delay (void) { /* usleep (1000); */ } int main (int argument_count, char** argument_vector) { int argument_index; int do_input = 1; program_name = argument_vector [0]; for (argument_index = 1; argument_index < argument_count; ++argument_index) { char* argument = argument_vector [argument_index]; if (argument [0] == '-') { fprintf (stderr, "\n%s: Unrecognized option: %s\n", program_name, argument); exit (1); } else { process_file (argument); do_input = 0; } } if (do_input) process_stream (stdin); return 0; } void process_file (const char* file) { FILE* stream; if ((stream = fopen (file, "r")) == NULL) { fprintf (stderr, "\nCannot read %s\n", file); exit (1); } process_stream (stream); } void process_stream (FILE* stream) { while (! feof (stream)) { int character = getc (stream); if (character == EOF) { fclose (stream); return; } fflush (stream); delay (); putc (character, stdout); } } - - - - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - - - -- Rick Busdiecker and Lehman Brothers 388 Greenwich Street ``A great many people think they are thinking when New York, NY 10013 they are merely rearranging their prejudices.'' (212) 464-4750 - William James