console application messages redirect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cm9kY2hhcg==?=

    console application messages redirect

    hey all,
    i have a console application that uses the console to display message status
    of my process. what's the best way (low impact) to get the messages as they
    are now into an email?

    thanks,
    rodchar
  • Peter Duniho

    #2
    Re: console application messages redirect

    On Wed, 22 Oct 2008 07:11:02 -0700, rodchar
    <rodchar@discus sions.microsoft .comwrote:
    hey all,
    i have a console application that uses the console to display message
    status
    of my process. what's the best way (low impact) to get the messages as
    they
    are now into an email?
    Redirect the output to a file and then send the file as email.

    Depending on how you're trying to do this, you can accomplish it
    programmaticall y. If you want to accomplish it from without the console
    application, you can use the Process class to run your console
    application, redirect the output and just write it to a memory data
    structure (String, MemoryStream, whatever), and then use the Smtp class to
    send the email.

    If you want to accomplish it from within the console application itself,
    then you might find that using Console.SetOut( ) to specify your own
    TextWriter to write to a memory data structure as above, and then using
    the Smtp class would work.

    Pete

    Comment

    Working...