Stderr redirection in VC 7 failed

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
 
N

ndessai

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
 
T

tom_usenet

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top