• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I/O Redirecting problem

 
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to replace std output with a printStream that
copies the output to console & a file,
the code

the code compiles OK, but the output is odd (shows on console & ccl.txt)
Java Rocks
va Rocks
Can someone throw some light ?
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chi
Try the following,

It worked for me.
I didn't understand why you were getting the wiered output. Also, I am not sure why you were overriding write() methods? How did you make sure that those methods are the ones you would need to override?
Thanks!
Maulin
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maulin,
Thanks for the advice, it worked and I understand better now.
For the write override thing, I am following the code example here. Maybe I does not follow it correctly.
regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic