jeudi 22 octobre 2015

Can't redirect std::err to allocated console

I am creating a console for my graphical application and redirecting std::cout std::cerr std::cin to it. I didn't try std::cin but messages outputed through std::cerr don't display at all. What can be the cause of this ? Other messages outputted with std::cout display fine.

Function below :

// Redirect IO to console
void RedirectIOToConsole()
{
    FILE *conin, *conout;
    AllocConsole();
    freopen_s(&conin, "conin$", "r", stdin);
    freopen_s(&conout, "conout$", "w+t", stdout);
    freopen_s(&conout, "conout$", "w+t", stderr);
}

Using Visual Studio 2015.

Aucun commentaire:

Enregistrer un commentaire