Stderr redirection in VC 7 failed

  • Thread starter Thread starter ndessai
  • Start date Start date
N

ndessai

Hi All,

I had a project which used to redirect stderr to a file in VC 6.
(working fine)

When I ported it to VC 7 it does not put messages in the file.

Any ideas???

Thanks,
Navanath
 
This is the code I use to redirect stderr to the file

if (_wfreopen(L"stderr.txt",L"a+",stderr) == NULL)
{
fputs("Failed to reopen stderr", stderr);
}

and after this statement I use some api ABCD(...) which writes some
messages to stderr

in this case it does not write any message to the file.

If I uncomment above redirection then calling the api does write the
messages to the console screen(which by default is stderrr).

Please let me know hwo can I redirect these messages to the file!!!

Thanks,
Navanath
 
Hi All,

I had a project which used to redirect stderr to a file in VC 6.
(working fine)

When I ported it to VC 7 it does not put messages in the file.

The standard way is to use freopen I think, although my C expertise is
patchy. Redirecting cerr is done with rdbuf.

Tom
 
Back
Top