C++ Borland Compiler

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
nakahisman
Posts: 3
Joined: Mon Jun 23, 2003 2:50 am

C++ Borland Compiler

Post by nakahisman »

I start using Borland Command Line Compiler with TextPad. But when I
write programs use "cin" to read console entry, output in the textpad is not sohwn. Like:
int a;
cout<<"Enter a unmer";
cin>>a;
cout<<"You Entered"<<a;

When I run this in console it works , but when I run this in textpad , it does not let me enter a number and it directly writes the
You Entered 8069560
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

It is not possible for a Windows application to redirect the standard input of a console application. Whe you add a tool to TextPad's menu that reads from stdin, make sure that Capture output is not checked. It will then run in its own console window.

Keith MacDonald
Helios Software Solutions
nakahisman
Posts: 3
Joined: Mon Jun 23, 2003 2:50 am

C++ Borland Compiler

Post by nakahisman »

Thank you very much for the reply, I unchecked the capture output,
but this time after I put the value that cin will read, when I hit enter console disaapears
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Re: C++ Borland Compiler

Post by Drxenos »

Also, you should keep in mind when writing C++ code that the runtime is not required to immediately output your text when sending data to a stream. So, if you want to guarantee that the text you send to cout gets displayed before it waits for input from cin, you should "send" either endl or flush to cout. Thus:

std::cout << std::endl;

OR

std::cout << std::flush;


Regards,

Rich
Post Reply