How do I output text to the same console that started the process?
If I use:
void writeln(String text)
{
// fprintf(stderr, "%s\n", text.c_str());
static HANDLE handle;
if (!handle) {
AllocConsole();
handle = GetStdHandle(STD_OUTPUT_HANDLE);
}
text += "\n";
WriteConsole(handle, text.c_str(), text.Length(), 0, 0);
}
It creates a new console window.
I want my output to go to the same console window that started it.
This is a full BCB GUI app using the VCL if it matters.
I have dug through all the C & Delphi stuff I can find but haven't found the answer yet.
Thanks!
If I use:
void writeln(String text)
{
// fprintf(stderr, "%s\n", text.c_str());
static HANDLE handle;
if (!handle) {
AllocConsole();
handle = GetStdHandle(STD_OUTPUT_HANDLE);
}
text += "\n";
WriteConsole(handle, text.c_str(), text.Length(), 0, 0);
}
It creates a new console window.
I want my output to go to the same console window that started it.
This is a full BCB GUI app using the VCL if it matters.
I have dug through all the C & Delphi stuff I can find but haven't found the answer yet.
Thanks!