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 gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

constream

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi, I'm writing a program in C++, compiling using the free Borland 5.5, and I'm writing it with DOS as my target OS (hopefully for the last time :) ). I have need for text colors and text windows, and I discovered the constream type, which seems to work fine, except when I input. When I input, I'm currently using cin >>, and the next thing I output always gets output on the left edge of the screen, ignoring the window's restraints. I've included a simple program that demonstrates what I mean. How do I make it so the output is within the window? Thanks a lot...

#include <iostream.h>
#include <constrea.h>

int main()
{
int x;
constream cout;
cout.window(2,2,79,24);
cout.clrscr();
cout << &quot;Test\n&quot;;
cin >> x;
cout << &quot;Test 2\n&quot;;
return 0;
}

The &quot;Test 2&quot; gets output as if there were no window.
???
 
I think the problem is that cin takes its input from the standard window. Your next call to cout sends its output to the same window that cin used. Instead of trying to name your new window cout what happens when you name it something like Mycout? I don't have access to my 5.5 compiler to test this.
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that I am now qualified
to do anything with nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top