Is there a way for using the console for output in VCL applications? Where does cout
actually direct the stream in VCL applications?
I did it as follows:
void TForm1::Button1Click(TObject *Sender)
{
out_to_console("Some text\n");
}
void out_to_console(std::string str)
{
AllocConsole() ;
AttachConsole(GetCurrentProcessId()) ;
std::freopen("CON", "w", stdout) ;
std::cout<<str;
}
Two questions still remain for me open:
\n
to see the text Some text
on the console?stdout
point to in VCL applications?