CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Posts
    3

    Does Anyone have the slightest idea on how to reset System.out?

    I have temporarily channeled the System.out.println using System.setOut:

    biteMe = new ByteArrayOutputStream();
    System.setOut(new PrintStream(biteMe,true));

    But... now I want to set it back to default (screen window) etc.

    Any clues??? Help Greatly Appreciated... No previous info found through search & Thanks inAdv



  2. #2
    Join Date
    Sep 2000
    Location
    Melbourne --> Australia
    Posts
    68

    Re: Does Anyone have the slightest idea on how to reset System.out?

    Hi there
    Before you use setOut, you can create
    a reference to dos's output ie :

    // Note you must do this before you change System.out so that you can get this reference
    OutputStream outs = System.out;
    PrintStream dos = new PrintStream(outs);



    Then later when you want to print back in dos
    you can do this:

    System.setOut(dos);



    Good luck
    Phill.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured