digitalmars.D.learn - redirect stdout stdio writeln
- GG (11/11) May 11 2011 Hi !
- Jesse Phillips (2/15) May 11 2011 That should work I usually just use > but no reason append shouldn't wor...
- GG (5/5) May 12 2011 Ok I found it, I have to put stdout.writeln not writeln. But don't know ...
Hi ! someone could say me if it's possible to redirect stdout of a program running in background to a file. I use writeln() to debug, I would like to redirect results of writeln() into file. I tried : program >> /tmp/log 2>&1 program >> /tmp/log program &> /tmp/log ...never success. so maybe it's not possible with writeln or I'm missing something. Thanks !
May 11 2011
GG Wrote:Hi ! someone could say me if it's possible to redirect stdout of a program running in background to a file. I use writeln() to debug, I would like to redirect results of writeln() into file. I tried : program >> /tmp/log 2>&1 program >> /tmp/log program &> /tmp/log ...never success. so maybe it's not possible with writeln or I'm missing something. Thanks !That should work I usually just use > but no reason append shouldn't work. In fact that method of redirection is purely on your shell to handle.
May 11 2011
Ok I found it, I have to put stdout.writeln not writeln. But don't know why we have to force like this. More strange, I only changed the first writeln to stdout.writeln and all next writeln will print in file too !!! If someone know why, I would like to understand. Thanks.
May 12 2011