CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Dec 2002
    Location
    Quebec
    Posts
    1

    Question How to give back hand to screen in C ?

    Hello everybody,

    I have a little problem..

    A program I'm modifying has the following behavior :

    If an option is given, it will write information messages to the screen, but if an other option is given, it will write information messages to a File named LogFile.txt ...

    Now, what's done in the code is this :

    freopen("LogFile.txt", "a+", stdout);
    To close stdout and assign LogFile.txt to the standard output.

    After everything is done, I need to give back the hand to the screen to write a message about the success of the program, based on some text in an other file.

    Everything I saw about the freopen function didn't talk about giving back the hand to the screen..

    I use
    freopen("NUL", "a+", stdout);
    to close the stream stdout assigned to LogFile ( it is shared by a lot of programs called from the main one) , but I can't write anything on the screen from then on.

    Does anybody know how I can write back to the screen without leaving the program ?

    Thanks
    Sylvain
    Last edited by sylvain_nurun; December 3rd, 2002 at 02:02 PM.

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