Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

console in windows app?

Status
Not open for further replies.

markus3000

Programmer
Aug 24, 2010
9
0
0
I'd like to get a console window up for debugging purposes, even though it's an "Application"; then I can use cin and cout. Is this possible?

thanks
 
I know that in the older versions of Builder (BCB 6 and older), you can. I suspect that the newer versions can, too, but I haven't tried it in them.

In BCB6 and older, there were two ways. One was to create the app in the IDE by selecting Console App instead of a Windows App or form. I've never done it this way, though.

The way I prefer was to just use my favorite editor, write and save the code, then call BCC32 to compile the .cpp file. I wrote many console apps that way.



James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Hi thanks, what I meant was that there already is a very large application I need to debug which uses forms, but I want to get console input and output as well..
possible?
 
It can be done but it is not a trivial thing to do. I do one of two things, I either send my output to a file via streams, or I use a message box. I prefer the message box since it is much simpler to use.
Code:
AnsiString MsgStr;
//MsgStr collects from info that you need to send out
//Use App's message box
Application->MessageBox(MsgStr, "Here's the info.", MB_OK);
//Or use a dialog box
MessageDlg(MsgStr.c_str(), mtInformation, TMsgDlgButtons() << mbOK, 0);

For error checking I prefer the App's message box since I can set the title but either one works.


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top