Next: , Previous: Extension Sample Revout, Up: Extension Samples   [Contents][Index]

16.7.8 Two-Way I/O Example

The revtwoway extension adds a simple two-way processor that reverses the characters in each line sent to it for reading back by the awk program. Its main purpose is to show how to write a two-way processor, although it may also be mildly amusing. The following example shows how to use it:

@load "revtwoway"

    cmd = "/magic/mirror"
    print "don't panic" |& cmd
    cmd |& getline result
    print result

The output from this program also is: ‘cinap t'nod’.