Probably you need to use `flush-output` to make sure that your printed
output is sent to the pipe.

When stdout goes to a terminal, the default buffer mode is
line-buffered, so that printing a newline causes output to be flushed.
For any other output destination, including a pipe to another process,
the default buffer mode is block-buffered, so that output will not be
flushed until the buffer is full.

Another approach is to write to stderr instead of stdout, since stderr
is never buffered by default.

I normally use `log-error` instead of printf. The output goes to stderr
when I run on the command line, but it adapts better to other
environments, such as running in DrRacket (where it goes to the log
window).

At Sat, 29 Oct 2016 13:45:43 +0200, meino.cra...@gmx.de wrote:
> Hi,
> 
> currently I am still doing old-school "printf()-debugging", knowing
> that it's '(print arg)' rather than 'printf( fmt, val,...);". :)
> 
> Since my program reads a bigger textfile of shortwave broadcasters,
> their frequencies, on-air times, etc...., reformats the whole thing
> and (currently only to proof, everything is correct) prints it.
> 
> Since I need to now, where strings are starting and ending, I am using
> 'print' for that rather than 'pretty-print' or 'display'.
> 
> I am doing all this on UNIX/Linux.
> 
> To give myself a chance of reading the output I do this
> 
> racket shwrefmt.rkt | vim -
> 
> which reads everything, which goes to stdout into vim.
> 
> As long as I am using 'display', everything is fine.
> When using 'print' the output mutates to smoke and vanishes in the pipe -
> Vim starts with nothing to show.
> 'print'ing to the console works fine, though.
> 
> Giving at the REPL
> > (current-output-port)
> it says
> #<output-port:stdout>
> 
> which looks like the good-old STDOUT of UNIX to me...
> 
> Where is the output gone? <<scratching my head>>
> 
> Thanks a lot for any help in advance!
> Cheers,
> Meino
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to