Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art.animation, 11 Feb 1994.
Re: Slow down the animation

Re: Slow down the animation

In article <gra...@netcom.com> gra...@netcom.com (gRaPpLe) writes:

   Newsgroups: alt.ascii-art.animation
   From: gra...@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 <stddef.h>
#include <stdio.h>
#include <stdlib.h>

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 <rf...@lehman.com> and <rf...@cmu.edu>
  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

Original message headers
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: rf...@lehman.com (Rick Busdiecker)
Subject: Re: Slow down the animation
In-Reply-To: gra...@netcom.com's message of Wed, 9 Feb 1994 09:58:25 GMT
To: gra...@netcom.com (gRaPpLe)
Message-ID: <RFB...@fnord.lehman.com>
Lines: 114
Sender: new...@lehman.com (News)
Nntp-Posting-Host: fnord
Organization: Lehman Brothers, Inc.
References: <gra...@netcom.com>
Date: Fri, 11 Feb 1994 14:46:33 GMT
About this message. This message was posted publicly to the newsgroup alt.ascii-art.animation in 1994 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post