X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,ac750d31c700498f X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 1993-11-10 04:31:01 PST Newsgroups: alt.ascii-art Path: gmd.de!xlink.net!howland.reston.ans.net!agate!headwall.Stanford.EDU!nntp.Stanford.EDU!eillihca@drizzle.Stanford.EDU From: eillihca@drizzle.StanFord.EDU ( Achille Hui, the Day Dreamer ) Subject: Re: How to slow down animation Message-ID: Sender: news@leland.Stanford.EDU (Mr News) X-Transfer-Agent: nntp.stanford.edu (NNTP) Organization: Dept. of Physics, Stanford University. Date: 10 Nov 93 12:03:31 GMT Lines: 117 blblam@cantor.math.uwaterloo.ca (Bernard Lam) writes: > > I'm just wondering how to slow down the animated files. When I view >the files using the 'cat' command in UNIX, it goes so fast that I can't s... > Following is a simple C-program I used to slow the display down, it is pretty BSDism and I hope it will work for you. Let's say you compile this program into an executable called slowcat, then you can try slowcat 1000 < your_anim_file This will try to display at most 1000 characters per second. Notice this program will try to perform some buffering to minimize its load. If you are desperate for single char I/O, you may also try the dd command, dd if=your_anim_file bs=1 ----slowcat.c------------------------------------------------------- #include #include #include void nap(unsigned int ms){ if(ms > 0){ struct timeval tm; tm.tv_sec = ms/1000000; tm.tv_usec = ms%1000000; select(0,0,0,0,&tm); } } int main(int argc,char *argv[]){ char buf[1024], *p, *q, *r; int len, delay = 500; argc--; argv++; if(argc-- > 0) if((len = atoi(*argv++))>0) delay = 1000000/len; for(len=1024; (len==1024) && ((len = fread(buf,1,1024,stdin)) > 0);) for(p = buf, q = p + len, r = p; p != q; p = r){ for(r++;r != q;r++) if((*r == '\n') || (*r == '\r') || ((r - p) > 128)) break; fwrite(p,r-p,1,stderr); nap(delay * (r-p)); } } -------------------------------------achille (eillihca@drizzle.stanford.edu) ObAscii: " "o ooo$oo "$$ o$$$$$$$$o "$$$$$$$" $$o o$$$$$$o$oo$$$ $$$$" ""$$$$$ooooo o$$$ o$$$""$"$$$$o$ooo o$$$" o$$$$" " "$$$$$$$$o$ o$$$ oo$$$$" oooo$$$$$$$$$o $$$ o$$$$$ oooo$$$$$$$$$$$$"""" $$"o$$$$$$$$$$$$$$$$$$"""" $$$$$$$$$$$$$$$""" $$$$$$"""" $$" $$ oo "o $$$$$$$$oo $$$$$"""""""$ o $$$"" $o $$$ "$o "$" o$$$ $$ "$$$$ "$" """ $ o " $$oooo oooo$ooo$$$$o$$$$$$$$ooo ooo$$$$$$$$$$$$$$$$$$$$"$$$""$$""$"o $$$$$$$$$$$$"$"$$$$ooo $$o " "" """$$ooo """"$$$$$o$$oo$$$$$$o ""o """""$$"$$$$"" "$$ $$ ooo$ooo$$$$$$$ $$$$$$$$$$$$$""" "$$"" " $$ $oo o "$$$ooo o$$$$$$$$$$$$$oo $$$o $$$$""""$""$"$$$ $$$o o$$ "" "o $ooo o o o "$$$ooooooo$ooo$$$$$$$$$$$$$$oo oooo$$$$$$$$$$$$$$$$"""$""""""""$o $$$$$$$$$"""""$"$$$oooo oo$oo $$$"" " " """$$$$$$$$$$$$$$$$ "$" " """$""$""" $ "$$$ooo o ooo oooo$o$o$$o$o$$ooo "$$$$$$$$$$$$$$$$$$$"$$$"$$$"$$ o o$$$$$$$$$$$"$$$$$$"o $oo $$$$"""" """$"$$$$$o$ooo$$$$$$ $$ """""$$$$$$$$"" ""o $$oo ooo o o$$$$$$$$$ooo o$$$$$""" """oo $$$$" o$$ "$$$ ""$oo ooo$$$ "$o ""$$$$$$$" $$ " " o" "$o$o "$$$oo "