Groups | Blog | Home
all groups > dotnet general > november 2003 >

dotnet general : NT Service and redirection of stdOut/stdError



José Joye
11/7/2003 6:00:53 PM
I have made a NT Service in c# and I need to use some features provided in a
legacy C library (it can be interfaced with callbacks and normal calls). So
far, no problem, I used p/Invoke and all is fine. However, this library
writes to stdOut/stdError. :-((
Is there a way at service startup (or later) to redirect stdOut/stdError to
files so as to prevent my Service to crash?

Thanks!

José

José Joye
11/10/2003 1:53:46 PM
Found it:

Must use:

[ DllImport( "Kernel32.dll" )]

internal static extern bool SetStdHandle( int nStdHandle, HandleRef hndRef);





José

[quoted text, click to view]

AddThis Social Bookmark Button