The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Larry Hammick on November 27, 2007, 09:38:59 PM

Title: Examples of pipes for the Win32 console
Post by: Larry Hammick on November 27, 2007, 09:38:59 PM
The zip contains three asm programs that read standard input and write standard output, so that they can be used as "pipes".
stdio.asm
is little more than a stub to illustrate the buffered file i/o and the get/put loop. It just capitalizes every byte in the input. When it's assembled, try e.g.
echo Hello|stdio
and out comes "HELLO", or enter
stdio<sometextfile
and the capitalized file is written to the screen.

The other two
8-7.asm
7-8.asm
are a little fancier. 8-7 slightly compresses any text that contains only lower ascii and no zeros, and 7-8 uncompresses the result. So if you go
type somefile|8-7
or
8-7<somefile
you see gibberish, but if you go
type somefile|8-7|7-8
or
8-7|7-8 <somefile
then out comes "somefile".



[attachment deleted by admin]
Title: Re: Examples of pipes for the Win32 console
Post by: donkey on November 28, 2007, 12:47:37 AM
Nice work Larry,

Very clear and useful example code covering a topic that seems to come up regularly here.