tags:

views:

168

answers:

1

What's up with this, how do I capture the output from my Gambit-C program?

$ gsi -e "(pp 'hello?)"
hello?

$ gsi -e "(pp 'hello?)" >asdf
hello?

$ gsi -e "(pp 'hello?)" 2>asdf
hello?

$ cat asdf

It should have put the output of the program into asdf, but it's empty! Is there a compile-time or run-time option I can set to make it treat stdout like a normal unix program? (Preferably compile-time)

+3  A: 

I am not familiar with pp, but you seem to want pretty-print:

$ gsi -e "(pretty-print 'hello?)" > test
$ cat test
hello?
$
Svante
You're right. I saw `pp` being used in lots of Gambit-C examples, but it's got specific semantics for the REPL, whereas `pretty-print` redirects as expected. I thought `pp` was just a synonym for `pretty-print`. Thanks.
Steve
Yea, pp is a totally different function (although confusingly, it is the _same_ in Chicken :S), and it allows really neat things like seeing the expansion of macros. Check out some macros sometime -- it's really useful and interesting.
Jyaan